R-alpha: Re^3: data file names

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
03 Dec 1997 21:58:07 +0100


Martin Maechler <maechler@stat.math.ethz.ch> writes:

> Factors are somewhat different in R and S
> (internally: clear;  in 'dput(.)' -- maybe not necessary).

Hmm:

R:

> dput(gl(4,1,8))
structure(factor(c(1, 2, 3, 4, 1, 2, 3, 4), levels=1:4), class =
"factor", .Label = c("1", 
"2", "3", "4"))
> ff<-structure(.Data = c(1, 2, 3, 4, 1, 2, 3, 4), .Label = c("1",
"2", "3", "4"), 
+         class = "factor")
> dput(ff)
structure(factor(c(1, 2, 3, 4, 1, 2, 3, 4), levels=1:4), class =
"factor", .Label = c("1", 
"2", "3", "4"))

Splus:

> dput(gl(4,1,8))
structure(.Data = c(1, 2, 3, 4, 1, 2, 3, 4), .Label = c("1", "2", "3", "4"), 
        class = "factor")
> ff<-structure(factor(c(1, 2, 3, 4, 1, 2, 3, 4), levels=1:4),
+ class = "factor", .Label = c("1", 
"2", "3", "4"))
> dput(ff)
structure(.Data = c(1, 2, 3, 4, 1, 2, 3, 4), .Label = c("1", "2", "3", "4"), 
        class = "factor")

I.e. when R creates a structure based on the output of Splus's dput(factor),
you get the same structure as if you had created the factor directly,
and vice versa. 

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._