Say we have a column in a df that is contains mostly numeric values, but a few rows are character:
row1 <- c(2, 3, 5, 1, 0)
row2 <- c(5, 2, "char", "word", 10)
df <- data.frame(row1, row2)
> df
row1 row2
2 5
5 char
1 word
3 2
0 10
How can I remove rows in the entire df
that contain a character in row2
, such that the final df
should look like this:
> df
row1 row2
2 5
3 2
0 10