[R] Removing rows in a data frame

Rainer Schuermann rainer.schuermann at gmx.net
Fri Jul 3 09:55:42 CEST 2015


Try

y <- x[ -( 30596:678013 ), ]

Please note that I have replaced 30595 with 30596 which is I think what you mean.

You can add a new column with

y$new <- new_column   # this is your vector of length 30595

Good luck,
Rainer


On Friday 03 July 2015 07:23:28 Charles Thuo wrote:
> I have a data frame whose rows are 678013 . I would like to  remove rows
> from 30696 to 678013 and then attach a new column with a length of 30595.
> 
> 
> I tried
> 
> Y<- X[-30595:678013,] and its not working
> 
> In addition how do i add a new column
> 
> Kindly assist.
> 
> Charles
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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