[R] table and getting rownames
Søren Merser
merser at image.dk
Wed Aug 18 17:13:39 CEST 2004
exactly what i needed
thanks a lot
soren
----- Original Message -----
From: "Peter Dalgaard" <p.dalgaard at biostat.ku.dk>
To: <merser at tiscali.dk>
Cc: "R-help" <r-help at stat.math.ethz.ch>
Sent: Tuesday, August 17, 2004 2:35 PM
Subject: Re: [R] table and getting rownames
> merser at tiscali.dk writes:
>
> > hi there
> > say that i have this table
> > >x<-table(adoc, oarb)
> > >x
> > oarb
> > 0 1
> > adoc
> > ab 1 0
> > am 5 1
> > ba 14 1
> > cc 271 3
> > ch 87 2
> > dz 362 6
> > fl 7 0
> > fs 84 2
> >
> > is there an easy way to get the row names or row numbers of rows with
> > oarb==0
> > i.e. (ab, fl) or (1, 7)
>
> Something like
>
> which(x[,"1"]==0)
> rownames(x)[x[,"1"]==0]
>
> --
> 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
>
More information about the R-help
mailing list