I am trying to plot a data frame that has two columns in r
that have the following format:
Col1-----name:"Date"-----class:"Date"----example: 2001-01-01 Col2-----name:TC---------class:"Numeric"----example:"4.50"
Here is a summary of the data frame I want to plot:
In order to plot the dataframe I am using the following command:
library(highcharter)
####################
#TC_df$fecha=as.numeric(as.POSIXct(TC_df$fecha))
####################
highchart(type="stock")%>%
hc_title(text = "Tipo de cambio") %>%
hc_subtitle(text = "ARS/USD y dolar sombra ") %>%
hc_xAxis(type = "Datetime", showLastLabel = TRUE,dateTimeLabelFormats =
list(day = "%d", month="%b",year="%y"))%>%
#hc_xAxis(categories = TC_df$fecha)%>%
hc_add_series(TC_df$TC, name = "reservas",type="line",color="green")
#hc_add_series(TC_df$dolarsombra, name = "USD
Sombra",type="line",color="blue")
The result I am having has the problem that dates in the x-axis are all on 1 January 1970 as this image shows:
[
Thanks in advance, so far this is my first post in stackoverflow, glad to receive some help from the community.