So I'm cleaning up a huge data file in R and an example is as shown:
ID Score
1001 4
1002 2
1003 h
1004 v
1005 3
Because the class of Score column is "character", I want to use the as.numeric function to convert 4,20 and 30 to numeric values. But since the data is dirty (contains unreasonable strings like h, v), I get the message:
NAs introduced by coercion.
When i run the following:
as.numeric(df$Score)
So what i want to do now is to remove the rows in the dataframe that contains strings with letters so that i would obtain:
ID Score
1001 4
1002 2
1005 3