When I use as.numeric
function on chr
type data, I get the warning that I mentioned in the title. I tried some recommended ways like x <- gsub(",","",x)
then as.numeric(x)
. When I used this way, even I didn't get any warning, I see my variable is still chr
when I used is.numeric(x)
What else can I do? By the way I am trying to work on
this data When I used str()
function, I saw some variables are chr
while some are num
. I didn't understand this distinction too.
Here is my dput of my example data:
dput(RTG[6:10, 1:5] )
structure(list(Date = c("02.11.2020", "02.11.2020", "02.11.2020", "02.11.2020", "02.11.2020"), Hour = c("5:00", "6:00", "7:00", "8:00", "9:00"), Total..MWh. = c("25,441.34", "26,408.77", "27,850.92", "32,157.29", "34,040.87"), Natural.Gas = c("7,933.72", "8,457.68", "9,506.90", "10,778.43", "11,026.81"), Dammed.Hydro = c("685.28", "1,055.67", "1,576.70", "4,423.02", "6,139.45")), row.names = 6:10, class = "data.frame")