In R 2.9.2,> URLdecode(c("a%20b", "b%20c"))[1] "a b" Warning message: In charToRaw(URL) : argument should be a character vector of length 1 all but the first element will be ignored Could URLdecode be modified to actually process all elements of the vector, not just the first? Thanks in advance
Here is a workaround URLdecode.vec <- Vectorize(URLdecode) # test it out x <- c("a%20b", "b%20c") URLdecode.vec(x) On Sat, Aug 29, 2009 at 10:31 AM, Jack Tanner<ihok at hotmail.com> wrote:> In R 2.9.2, > >> URLdecode(c("a%20b", "b%20c")) > [1] "a b" > Warning message: > In charToRaw(URL) : argument should be a character vector of length 1 > all but the first element will be ignored > > Could URLdecode be modified to actually process all elements of the vector, not > just the first? > > Thanks in advance > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Not sure if your context is rapache, but if so urlEncode() and urlDecode() are available to you and are vectorized: http://biostat.mc.vanderbilt.edu/rapache/manual.html#urlEncode Best, Jeff -----Original Message----- From: r-help-bounces@r-project.org on behalf of Jack Tanner Sent: Sat 8/29/2009 9:31 AM To: r-help@stat.math.ethz.ch Subject: [R] RFE: vectorize URLdecode In R 2.9.2,> URLdecode(c("a%20b", "b%20c"))[1] "a b" Warning message: In charToRaw(URL) : argument should be a character vector of length 1 all but the first element will be ignored Could URLdecode be modified to actually process all elements of the vector, not just the first? Thanks in advance ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]]