[R] "Special" characters in URI
Gregor GORJANC
gregor.gorjanc at bfro.uni-lj.si
Tue May 3 14:52:50 CEST 2005
Henrik Bengtsson wrote:
> Gregor GORJANC wrote:
...
>> What do you think about this scratch, which afcourse doesn't solve all
>> "special" characters:
>>
>> fixURLchar <- function(URL,
>> from = c(" ", "\"", ",", "#"),
>> to = c("%20", "%22", "%2c", "%23"))
>
>
> Just a comment. It is much safer/easier to use named vectors for
> mapping, e.g.
>
> map <- c(" "="%20", "\""="%22", ","="%2c", "#"="%23")
>
...
Henrik, thanks. So you suggest something like
for (i in seq(along=map)) {
URL <- gsub(pattern=names(map)[i], replacement=map[i], x=URL)
}
--
Lep pozdrav / With regards,
Gregor Gorjanc
----------------------------------------------------------------------
University of Ljubljana
Biotechnical Faculty URI: http://www.bfro.uni-lj.si/MR/ggorjan
Zootechnical Department mail: gregor.gorjanc <at> bfro.uni-lj.si
Groblje 3 tel: +386 (0)1 72 17 861
SI-1230 Domzale fax: +386 (0)1 72 17 888
Slovenia, Europe
----------------------------------------------------------------------
"One must learn by doing the thing; for though you think you know it,
you have no certainty until you try." Sophocles ~ 450 B.C.
More information about the R-help
mailing list