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@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@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.

Reply via email to