Btibert3 Btibert3 - 2 months ago 6x
R Question

Encode a query string in R

Here is a query string that I use to plug into a form:


and here is the resulting string that is passed to the website:


I know that R is a very powerful language. Are there any functions that would encode this for me? I figure I could write a function to mimic this output, but I didn't want to reinvent the wheel.

Any help will be greatly appreciated.


curlEscape in package RCurl does what you want:

> library(RCurl)
Loading required package: bitops
> curlEscape("team,site,week,day,date,o:team,line,points,o:points@season=2011")
[1] "team%2Csite%2Cweek%2Cday%2Cdate%2Co%3Ateam%2Cline%2Cpoints%2Co%3Apoints%40season%3D2011"