The reference file for sprintf
:
Wrapper for C function sprintf, ...
This way you avoid it in R
same way you do for C
, using the double warning signs %%
to create one %
, according
How to avoid sprintf ()% errors so that they are not recognized as variables?
In your code, we create a URL supposedly retrieving the first page in this search for amazon.com:
url<-(sprintf('https://www.amazon.com/s/ref=sr_pg_%s?rh=n%%3āāA172282%%2Cn%%3A%%21āā493964%%2Cn%%3A50239āā4%%2Cn%%3A281052%%2Cāān%%3A12556502011%%2Cāān%%3A3017941&page=%sāā&ie=UTF8', start, start))
produces
> url [1] "https://www.amazon.com/s/ref=sr_pg_1?rh=n%3A172282%2Cn%3A%21493964%2Cn%3A502394%2Cn%3A281052%2Cn%3A12556502011%2Cn%3A3017941&page=1&ie=UTF8"
source share