[R] Rows with positive values
arun
smartpink111 at yahoo.com
Tue Sep 3 16:42:07 CEST 2013
Hi,
set.seed(285)
dat1<- as.data.frame(matrix(sample(c(-3:30),10*100,replace=TRUE),ncol=10))
dat2<- dat1[!rowSums(dat1<0),]
head(dat1,3)
# V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
#1 21 19 16 24 11 -1 4 13 18 -3
#2 3 13 13 29 16 29 16 18 12 12
#3 13 22 14 25 9 19 13 30 6 6
head(dat2,3)
# V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
#2 3 13 13 29 16 29 16 18 12 12
#3 13 22 14 25 9 19 13 30 6 6
#11 23 20 5 27 1 24 18 18 26 14
A.K.
________________________________
From: Vivek Das <vd4mmind at gmail.com>
To: arun <smartpink111 at yahoo.com>
Sent: Tuesday, September 3, 2013 10:34 AM
Subject:
Hi Arun,
I would like to know if you have any idea of any function in R by which you can only extract rows from a data frame having only positive values. Is there any way to do it?
----------------------------------------------------------
Vivek Das
PhD Student in Computational Biology
Giuseppe Testa's Lab
European School of Molecular Medicine
IFOM-IEO Campus
Via Adamello, 16
Milan, Italy
emails: vivek.das at ieo.eu
vchris_05 at yahoo.co.in
vd4mmind at gmail.com
More information about the R-help
mailing list