[R] Removing rows from a data frame

Erik Iverson iverson at biostat.wisc.edu
Mon Jun 30 19:44:39 CEST 2008


R is doing what you are telling it to do. You aren't assigning the 
result of your indexing to a new data.frame, and so it is simply 
print()ing the result.  Example,

x <- 1:10
x[-1]
x

vs.

x <- 1:10
x <- x[-1]
x


Joe Trubisz wrote:
> Hi...
> 
> I have a rather large dataframe that I'm trying to remove rows from.
> I'm issuing the command:
> 
> dtx[-which(dtx$rdate > "2008-06-16"),]
> 
> and it tries to print out over 170,000 lines of output. So...I did:
> 
> options(max.print=1e6)
> 
> and ran it again. It worked, but when I did a:
> 
> which(dtx$rdate > "2008-06-16")
> 
> it tells me that all the data I thought I deleted is still there.
> 
> Where am I going wrong??
> 
> TIA,
> Joe
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list