简体   繁体   English

想要消除一列中第一个条目以字母E开头的所有行

[英]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.

相关问题 子集在一列中具有相同值的所有行,按另一列分组,其中第三列的至少一行包含 R 中的特定字母 - subset all rows with the same value in one column, grouped by another column, where at least one row of third column contains a specific letter in R 如果数据框的一个列条目是另一列条目的子字符串,则删除行 - Delete rows if one column entry of a dataframe is a substring of another column entry 在 R 中,对于除一个之外的所有列,从其自身中减去列中的第一行以及该列中的所有行 - Subtract first row in a column from itself and all rows in that column, for all columns but one, in R 我想获取数据框中所有行的行号,其中列中的元素包含向量中的元素 - I want to get row numbers of all rows in a dataframe where an element in a column contains an element in a vector R从数据框中选择所有行,在该数据框中,一个值重复一列,但在另一列中具有特定值 - R select all rows from a dataframe where a value is duplicated one column but has a specific value in another column 如何消除集合中的所有行或仅包含一个实体的行(在 R 中) - How to eliminate all rows in a set or rows containing only one entity (in R) 根据列的第一个值对所有行进行子集 - Subset All Rows Based on First Value of Column Select 行,其中只有一列有值,所有其他列都有 NA - Select rows where only one column has a value and all other columns have NA 从一个数据框中选择所有列值都存在于第二个数据框中的行 - Select rows from one data frame where all column values exist in the second data frame 如何 select 一列具有以“006”结尾的行的所有列 - How to select all columns where one column has rows that end with '006'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM