filtering the rows in R
Hi Guys,
I have a .txt file in which there are 13 columns. the first one is Characters(names) and the next 12 are numbers. also there are 1000 rows. I want to filter out the rows in which even one column has the value less than 10. in other word I just need the rows with values equal or more than 10 in all columns. could you please let me know how I can do that in R?
thanks.
• 2,984 views
•
link
3 answers
d = as.data.frame(matrix(rnorm(1000, mean=20, sd=5), ncol=10))
d2 = d[which(apply(d, 1, function(x) min(x) >= 10)),]
• 0 views
•
link
Not really a bioinformatics question but have you looked at subset() ?
• 0 views
•
link
Log in to answer this question.
not a bioinformatics question: ask in stackoverflow please : http://stackoverflow.com/
While, indeed, this question isn't purely bioinformatics, it's application clearly is. I would argue the question fits here, but that's just my opinion...