So I have been trying to plot the following data frame :
head(MonthlyAveragePriceHAIRPEPE)
month AveragePrice pct.chg
1 2016-09 3.17 NA
2 2016-10 0.792 -0.750
3 2016-11 0.225 -0.715
4 2016-12 0.179 -0.204
5 2017-01 0.445 1.48
6 2017-02 3.36 6.55
The problem is that, when I plot with the following line of code plot(MonthlyAveragePriceHAIRPEPE$month, MonthlyAveragePriceHAIRPEPE$AveragePrice)
, I get the following :
Error in plot.window(...) : need finite 'xlim' values.
In addition : Warning messages :
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
I don't know how to solve those problems... I think it comes from the class of the month column, which is "character", but when I try to pass it to "factor", all I get are NA's... The class of the Average price is numeric and I get no problem plotting it alone. I think the problem really concerns the "month" column and its class...
The infos of the df are the following :
dput(head(MonthlyAveragePriceHAIRPEPE, 10))
structure(list(month = c("2016-09", "2016-10", "2016-11", "2016-12",
"2017-01", "2017-02", "2017-03", "2017-04", "2017-05", "2017-06"
), AveragePrice = c(3.16968709677419, 0.791904347826087, 0.225412279295455,
0.179445766423358, 0.444554531722054, 3.35761658783784, 5.6894554715794,
16.6639257580906, 53.1994216287425, 66.4208618873239), pct.chg = c(NA,
-0.750163242096669, -0.71535415872605, -0.203921955874672, 1.4773754242451,
6.55276652974736, 0.694492305103592, 1.9289139956068, 2.19249031716991,
0.24852601501664)), row.names = c(NA, -10L), class = c("tbl_df",
"tbl", "data.frame"))
Many thanks in advance !