Re: [R] table and getting rownames
exactly what i needed thanks a lot soren - Original Message - From: Peter Dalgaard [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: R-help [EMAIL PROTECTED] Sent: Tuesday, August 17, 2004 2:35 PM Subject: Re: [R] table and getting rownames [EMAIL PROTECTED] writes: hi there say that i have this table x-table(adoc, oarb) x oarb 0 1 adoc ab1 0 am5 1 ba 14 1 cc 271 3 ch 87 2 dz 362 6 fl7 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 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] table and getting rownames
hi there say that i have this table x-table(adoc, oarb) x oarb 0 1 adoc ab1 0 am5 1 ba 14 1 cc 271 3 ch 87 2 dz 362 6 fl7 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) regards soren __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] table and getting rownames
On Tue, 17 Aug 2004 [EMAIL PROTECTED] wrote: say that i have this table x-table(adoc, oarb) x oarb 0 1 adoc ab1 0 am5 1 ba 14 1 cc 271 3 ch 87 2 dz 362 6 fl7 0 fs 84 2 is there an easy way to get the row names or row numbers of rows with oarb==0 That seems to be with *entry* zero, not oarb = 0? i.e. (ab, fl) or (1, 7) rows(x)[x==0] rownames(x)[rows(x)[x==0]] will do what I think you meant to ask. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html