[R] How to delete rows from dataframe that sum to zero

2012-04-26 Thread Emily O'Connor
Hello, I am trying to figure out how to delete all rows which sum to zero from a dataframe. I do not have a column with the sum of each column yet, so perhaps that would need to be done first? Thank you for any help anyone can offer with this. Emily PS sorry if this question has already been ans

Re: [R] How to delete rows from dataframe that sum to zero

2012-04-26 Thread ghostwheel
Here's an example a=data.frame( sample(0:1,20,rep=T), sample(0:1,20,rep=T) ) # make 2 random columns of length 20. a.no0 = a[ rowSums(a)!=0, ] -- View this message in context: http://r.789695.n4.nabble.com/How-to-delete-rows-from-dataframe-that-sum-to-zero-tp4589289p4589308.html Sent from the R