data(airquality) head(airquality) Suppose you want to remove the 1st and the 3rd column this will do airquality[,-c(1,3)]
suman dhara wrote: > > Can you suggest me any way to remove a column of a data frame by the > column > number,not by the column name. > > Thanks, > Suman Dhara > > [[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. > > -- View this message in context: http://r.789695.n4.nabble.com/Removing-columns-from-data-frame-referenced-by-column-index-tp2236906p2237076.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.