I'm looking for a simple way to check if values in an R data frame have comma (or any character for that matter).
Let's suppose I have the following data frame:
df <- data.frame(A = c("apple","orange", "banana","strawberries"),
B = c(23,12,10,15),
C = c("2,53", "1.35","0,25","1,44"))
If I know the column with commas in it I use this:
which(grepl(",",df$C))
length(which(grepl(",",df$C)))
However, I want an output as the one above but not specifying the column of my dataframe.
Any suggestions?