[R] error with demo in gsubfn on Mac; Re: string parsing
David Winsemius
dwinsemius at comcast.net
Wed Feb 16 23:09:41 CET 2011
On Feb 16, 2011, at 4:13 PM, Gabor Grothendieck wrote:
> On Wed, Feb 16, 2011 at 3:42 PM, David Winsemius <dwinsemius at comcast.net
> > wrote:
>>
>> On Feb 16, 2011, at 3:25 PM, Gabor Grothendieck wrote:
>>
>>> On Tue, Feb 15, 2011 at 5:20 PM, Sam Steingold <sds at gnu.org> wrote:
>>>>
>>>>
>>>
>>> Check the example at the end of section 2 of the gsubfn vignette:
>>>
>>> http://cran.r-project.org/web/packages/gsubfn/vignettes/gsubfn.pdf
>>
>> OK. I'm impressed. So I loaded gsubfn to do some self study and got:
>>
>>> 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
>>> sessionInfo()
>> R version 2.12.1 (2010-12-16)
>> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
>>
>> locale:
>> [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>>
>> attached base packages:
>> [1] splines stats graphics grDevices utils datasets
>> [7] methods base
>>
>> other attached packages:
>> [1] gsubfn_0.5-5 proto_0.3-8 rms_3.1-0 Hmisc_3.8-3
>> [5] survival_2.36-2 sos_1.3-0 brew_1.0-4 lattice_0.19-13
>>
>> loaded via a namespace (and not attached):
>> [1] cluster_1.13.2 grid_2.12.1 tools_2.12.1
>>
>
> I can't reproduce this on my Windows system. I assume its a character
> set issue associated with the Mac. What happens when you try this
> first (or some variation):
>
> Sys.setlocale("LC_ALL","C")
> demo("gsubfn-si")
First it loads X11() and then I get:
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".
--
David.
>
> ?
>
> --
> Statistics & Software Consulting
> GKX Group, GKX Associates Inc.
> tel: 1-877-GKX-GROUP
> email: ggrothendieck at gmail.com
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list