As.numeric not working

I'm trying to change a character column into a numerical one. I downloaded data off the FBI's hate crime list, and R is counting the number of victims as a character. This is my code:

fbi12_18 %>%
unlist("count") %>%
as.numeric("count")

but the count column is still coming up as a character? If I don't include unlist() I get "Error in function_list[k] : 'list' object cannot be coerced to type 'double' " but I don't know what's wrong with the as.numeric ?

Hard to tell without a reprex, but likely culprit is your data structure. You probably have a recursive list and are pointing as.numeric() at a list-within-a-list, which won't work.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.