Re: [R] "Special" characters in URI

From: Gregor GORJANC <gregor.gorjanc_at_bfro.uni-lj.si>
Date: Tue 03 May 2005 - 22:52:50 EST

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.

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Tue May 03 23:05:00 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:32 EST