[R] Linux-Windows problem

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Jul 6 17:50:42 CEST 2010



On 06.07.2010 15:24, Henrik Bengtsson wrote:
> Sorry for asking the obvious, but have you confirmed that you are
> running the same version of R on both systems?


Since the question was about the Editor, I doubt the R version is related.


> /H
>
> On Tue, Jul 6, 2010 at 2:11 PM, Bos, Roger<roger.bos at rothschild.com>  wrote:
>> Uwe,
>>
>> I suspect I might be having a similar problem as the R code I generate
>> in Windows editor (Tinn-R) doesn't always open properly in my Linux
>> editor (Rkward), but I don't know how to change the default encoding in
>> either one.

I am neither using Tinn-R nor Rkward, hence I cannot give any advice here.

Uwe


>
>> In R on both machines, getOption("encoding") returns "native.enc", so
>> the problem is not with R, but rather at the OS or editor level.  If you
>> or anyone could help me out that would be appreciated.
>>
>> Thanks,
>>
>> Roger
>>
>> -----Original Message-----
>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
>> On Behalf Of Uwe Ligges
>> Sent: Monday, July 05, 2010 10:04 AM
>> To: Ildiko Varga
>> Cc: r-help at r-project.org
>> Subject: Re: [R] Linux-Windows problem
>>
>>
>>
>> On 05.07.2010 14:31, Ildiko Varga wrote:
>>> Dear All,
>>>
>>> I faced the following problem. With the same data.frame the results
>>> are different under Linux and Windows.
>>> Could you help on this topic?
>>
>> I guess you read in the data differently since you have different
>> default encodings on both platforms (e.g. latin1 vs. UTF-8) and you data
>> is probably not plain ASCII.
>>
>> Best,
>> Uwe Ligges
>>
>>> Thanks in advance,
>>> Ildiko
>>>
>>> Linux:
>>>    >    d = read.csv("CRP.csv")
>>>    >    d$drugCode = as.numeric(d$drug)
>>>    >    cor(d, use="pairwise.complete.obs")
>>>              PATIENT     BL.CRP   X24HR.CRP   X48HR.CRP drug   drugCode
>>> PATIENT        NA         NA          NA          NA   NA         NA
>>> BL.CRP         NA  1.0000000  0.84324880 -0.05699590   NA -0.3367147
>>> X24HR.CRP      NA  0.8432488  1.00000000 -0.06162383   NA -0.3557316
>>> X48HR.CRP      NA -0.0569959 -0.06162383  1.00000000   NA  0.1553356
>>> drug           NA         NA          NA          NA   NA         NA
>>> drugCode       NA -0.3367147 -0.35573159  0.15533562   NA  1.0000000
>>> Warning message:
>>> In cor(d, use = "pairwise.complete.obs") : NAs introduced by coercion
>>>    >    str(d)
>>> 'data.frame':   41 obs. of  6 variables:
>>>     $ PATIENT  : Factor w/ 41 levels "RV13","RV14",..: 2 3 4 6 7 12 13
>>> 14
>>> 15 17 ...
>>>     $ BL.CRP   : num  7.3 31.2 4.2 6.7 1.6 7.7 5.3 38.9 1 7.3 ...
>>>     $ X24HR.CRP: num  6.1 24.9 11.1 4.9 1 5 3.7 18 1 7.3 ...
>>>     $ X48HR.CRP: num  121.5 40 28.4 34.5 33.3 ...
>>>     $ drug     : Factor w/ 2 levels "active","placebo": 1 1 1 1 1 1 1 1
>> 1
>>> 1 ...
>>>     $ drugCode : num  1 1 1 1 1 1 1 1 1 1 ...
>>>
>>>            Windows:
>>>    >    d = read.csv("CRP.csv")
>>>    >    d$drugCode = as.numeric(d$drug)
>>>    >    cor(d, use="pairwise.complete.obs") Error in cor(d, use =
>>> "pairwise.complete.obs") : 'x' must be numeric
>>>    >    str(d)
>>> 'data.frame':   41 obs. of  6 variables:
>>>     $ PATIENT  : Factor w/ 41 levels "RV13","RV14",..: 2 3 4 6 7 12 13
>>> 14
>>> 15 17 ...
>>>     $ BL.CRP   : num  7.3 31.2 4.2 6.7 1.6 7.7 5.3 38.9 1 7.3 ...
>>>     $ X24HR.CRP: num  6.1 24.9 11.1 4.9 1 5 3.7 18 1 7.3 ...
>>>     $ X48HR.CRP: num  121.5 40 28.4 34.5 33.3 ...
>>>     $ drug     : Factor w/ 2 levels "active","placebo": 1 1 1 1 1 1 1 1
>> 1
>>> 1 ...
>>>     $ drugCode : num  1 1 1 1 1 1 1 1 1 1 ...
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> 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.
>>
>> ______________________________________________
>> 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.
>> ***************************************************************
>>
>> This message is for the named person's use only. It may\...{{dropped:20}}
>>
>> ______________________________________________
>> 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.
>>
>
> ______________________________________________
> 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.



More information about the R-help mailing list