Reputation: 421
I want to identify all elements with exactly 2 decimal places but i have no idea how to handle that problem...
Example:
x<-data.frame(col1=c("A","B","C"),
col2=c("1.32","1.235","1.22"))
As a result i only would like to have the corresponding elements from col1, in this case: A C
Upvotes: 3
Views: 80
Reputation: 887691
We can use grep
x$col1[grep('\\..{2}$', x$col2)]
#[1] A C
#Levels: A B C
Upvotes: 4