Re: [R] Removing rows from a data frame

From: Erik Iverson <iverson_at_biostat.wisc.edu>
Date: Mon, 30 Jun 2008 12:44:39 -0500

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.



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. Received on Mon 30 Jun 2008 - 17:53:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 30 Jun 2008 - 18:30:57 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive