Btibert3 Btibert3 - 1 year ago 89
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.

Answer Source

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"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download