I have a dataset of multiple types. It was created in an Excel spreadsheet so some numbers contain commas (e.g. 1,346 instead of 1346). Hence, making them of type character instead of numeric.
Here's what I attempted to make the conversion:
df[-2] %>% select_if(is.character) %>% as.numeric(gsub(",", "", df))
I am excluding the second column from the selection as it is a valid character type for my analysis.
The error I am getting is:
Error in df[-2] %>% select_if(is.character) %>% as.numeric(gsub(",", : 'list' object cannot be coerced to type 'double'
How could I make this work?