[R] delete rows

Robert Baer rbaer at atsu.edu
Mon Feb 7 21:17:59 CET 2011


Assuming your data is in a dataframe called df:
# make fake df
df = data.frame(a=1:472, b=1001:1472)
df[416:472, ]  # check the rows you want to remove
df[-(416:472), ]   # remove them
df  # see what's left

--------------------------------------------------
From: "Christopher Porter" <CPORTER at clemson.edu>
Sent: Sunday, February 06, 2011 8:16 PM
To: <r-help at stat.math.ethz.ch>
Subject: [R]  delete rows

> Hello. I came across your response in an R forum and could use your help. 
> I have a data set with 472 rows. I want to delete rows 416 through 472. 
> The name of my data set is MERGE.
>
> I am an extreme R novice. How do I write a script to accomplish this?
>
>
> Thank you.
>
>
>
> ---
> Christopher H. Porter, M.A., M.Ed.
> Director, Undergraduate Recruitment
> College of Engineering and Science
> Clemson University
>
> 106B Holtzendorff Hall
> (864) 656-7870
> (864) 656-1327 - Fax
> AIM: ClemsonCES
> http://www.clemson.edu/ces/psu/
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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