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]]
Hi, On Sun, Feb 6, 2011 at 6:16 PM, Christopher Porter <CPORTER at clemson.edu> wrote:> 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.Try this: MERGE2 <- MERGE[-c(416:472), ] Cheers, Josh> > 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.-- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/
?subset On Mon, Feb 7, 2011 at 7:46 AM, Christopher Porter <CPORTER at clemson.edu> wrote:> 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. >
On Sun, Feb 6, 2011 at 6:16 PM, Christopher Porter <CPORTER@clemson.edu>wrote:> 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? >By first reading "An Introduction to R" before posting such basic questions on this list?? -- Bert> > > 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@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. >-- Bert Gunter Genentech Nonclinical Biostatistics [[alternative HTML version deleted]]
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. >