[R] error with demo in gsubfn on Mac; Re: string parsing

Gabor Grothendieck ggrothendieck at gmail.com
Wed Feb 16 23:15:10 CET 2011


On Wed, Feb 16, 2011 at 5:09 PM, David Winsemius <dwinsemius at comcast.net> wrote:
>
>>>> require(gsubfn)
>>>
>>> Loading required package: gsubfn
>>> Loading required package: proto
>>>>
>>>> demo("gsubfn-si")
>>>
>>>
>>>       demo(gsubfn-si)
>>>       ---- ~~~~~~~~~
>>>
>>> Type  <Return>   to start :
>>> Error in source(available, echo = echo, max.deparse.length = Inf,
>>> keep.source = TRUE) :
>>>  invalid multibyte character in parser at line 8
>>>>
>
>        demo(gsubfn-si)
>        ---- ~~~~~~~~~
>
> Type  <Return>   to start :
>
>> # given number possibly followed by SI letter (e.g. 32.5k where k means
>> 1000)
>> # replace letter with e followed by appropriate digits.
>> # (see formatEng2R by Hans-Joerg Bibiko in the R Wiki)
>>
>> conv <- list(y = "e-24", z = "e-21", a = "e-18", f = "e-15", p = "e-12",
> +     n = "e-9", `µ` = "e-6", m = "e-3", d = "e-1", c = "e-2", k = "e3",
> +     M = "e6", G = "e9", T = "e12", P = "e15", E = "e18", Z = "e21", Y =
> "e24")
>
>> gsubfn(".$", conv, c("19", "32.5M"))
> Loading required package: tcltk
> Loading Tcl/Tk interface ... done
> [1] "19"     "32.5e6"
>
> I don't see any unusual characters in that output... ooops, there is it
> is... that "mu".

Thanks. I will change it to just plain u in the next release.

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list