I have small data set with one column in char format. Below you can see data.
test<-structure(list(txtVALUE = c("<5", "<5", "8", "<5", "9", "12",
"45", "5", "<5", "<5", "11,478", "117", "1,526", "1,642", "3,920",
"98", "8", "<5", "<5", "<5", "<5")), row.names = c(NA, -21L), class = c("tbl_df",
"tbl", "data.frame"))
Now I want to convert this data from chr
format in numeric.I tried with this command below
test$txtVALUE<-as.numeric(test$txtVALUE)
Warning message:
NAs introduced by coercion
But this command does not convert data as I expected. Namely, numbers such as "1,526", "1,642", and "3,920" are converted in NAN values, although they are numbers.
So can anybody help me how to convert this data from char to numeric in the proper way without NaN for numbers?