[R] two bugs ?
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Thu Aug 22 10:49:58 CEST 2002
"ken_lee" <ken_lee at tynesys.com> writes:
> Dear,
> I thought these two example are bugs.
> example 1: colnames issue
> > tmp<-data.frame(value=1:3,group1=1:3)
> > if (length(tmp$group)>1) z<-1 else z<-2
> > print(z)
>
> [1] 1
tmp$group is 1:3 because of partial matching in "$" (which is not a
bug, but maybe a design infelicity).
> example2 : length issue
> > tmp<-data.frame(value=1:3,group=c("a","a","b") )
> > tmp1<-gsummary(tmp,FUN=length,groups=tmp$group)
> > tmp1
> value group
> a 2 a
> b 1 b
>
> > tmp<-data.frame(value=1:3,group=c("a","c","b"))
> > tmp1<-gsummary(tmp,FUN=length,groups=tmp$group)
> > tmp1
> value group
> a 1 a
> b 3 b
> c 2 c
That's how gsummary (from nlme) works. Look at the definition of FUN.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list