TSR TSR - 1 year ago 375
R Question

Replace space with %20 in r

I have following string:

url <- https://www.google.mu/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=green carot

I want to replace the space between green and carot with %20


Answer Source

Should this (for a straight sring replacement) be

> gsub(" ","%20"),url

Though, a URL encode function would be better

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download