How do I remove special characters like # from a dataset in R? I have dataset like this,
X Id V1 V2
1 65 245 Good
2 41 245 Good
3 48 245 $
4 74 245 Good
6 54 Good
7 60 245 Good
I tried to remove the special characters by using the following line
df2[, (1:3)] <- sapply(df2[, (1:3)], function(col) {
as.numeric(sub("[*]$#", "", col))
})
but this is not working? Is their any way to remove the blank cells as well using the above code or in one same line?