[R] To delete rows in a dataframe

Sumanta Basak sumantab at ambaresearch.com
Mon Nov 20 10:28:23 CET 2006


Try ?subset.

See the following example.

nm <- rownames(state.x77)
start_with_M <- nm %in% grep("^M", nm, value=TRUE)
subset(state.x77, start_with_M, Illiteracy:Murder)



-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Shubha Vishwanath
Karanth
Sent: Monday, November 20, 2006 2:20 PM
To: r-help at stat.math.ethz.ch
Subject: [R] To delete rows in a dataframe

Hi everybody,

 

Does anyone know how to delete certain rows (satisfying a particular
condition) of a data frame in R?

 

Thanks u,

Shubha


	[[alternative HTML version deleted]]

______________________________________________
R-help at stat.math.ethz.ch 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