Hello,
I have some columns that when I try to convert to numeric, gets converted to NAs instead. Columns C and D have numeric values, but gets replaced with NA when I try to use as.numeric. The original data is huge and I have several columns with different classes (class 1 - 5) from column "class". I would like to convert all data into numeric leaving date and class columns. Is there anyway to convert everything to numeric correctly without replacing with NAs instead.
Thanks for your help!
df <- data.frame(
stringsAsFactors = FALSE,
date = c("2000-01-01",
"2000-04-01","2000-07-01","2000-10-01"),
class = c("Class 5", "Class 5", "Class 5", "Class 5"),
A = c(11882, 14281, 8846, 8432),
B = c("89.60", "92.00", "92.30", "92.60"),
C = c("166,834,223",
"168,695,652","168,387,103","169,647,762"),
D = c("21,344,544",
"21,298,930","21,236,265","21,471,803")
)