[英]Want to eliminate all rows where first entry in one column starts with the letter E
> Data2<-cbind(c("ETDG","EDJG","METW","TDBT","EITC"),c(1,5,3,4,2))
> Data2
> [,1] [,2]
[1,] "ETDG" "1"
[2,] "EDJG" "5"
[3,] "METW" "3"
[4,] "TDBT" "4"
[5,] "EITC" "2"
I am coding and R and I want to eliminate all of the rows in the above array with entries in the first column that start with the letter E, and I want to do it all at once. 我正在用R编码,我想消除第一列中以字母E开头的条目的上述数组中的所有行,我想一次全部完成。 Is there an easy way to achieve this? 有没有简单的方法可以做到这一点?
Data2[toupper(substr(Data2[,1],1,1)) != "E",]
Data2 <- Data2[!grepl("^E",Data2[,1]),]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.