You cannot change the datafile directly - it is a reactive source that cannot be changed except by a user input (in this case the choice of data file).
You have 2 choices (that I know of):
1) Make a new object that holds the reformatted date:
NewDate<-reactive({ as.POSIXct(paste(FECHA,H_SOLAR),
format = "%y/%m/%d %H:%M:%S")})
then use NewDate()
as your variable for graphing.
2) Change the date format within the function that makes the graph. e.g.
plot(x~as.POSIXct(paste(FECHA,H_SOLAR),format="%y/%m/%d %H:%M:%S"),
data=datos())
Here is a somewhat similar issue:Formatting reactive data.frame
EDIT
In response to the edited question - here is an updated answer.
I don't know much about ggplot
but if the issue is to get this all into one data.frame
, then you might want to do something like this:
datos=reactive({read.csv(input$dataset,header=T,sep=";",na.strings="-99.900"))}
NewDate<-reactive <- ({as.POSIXct(paste(FECHA,H_SOLAR),
format = "%y/%m/%d %H:%M:%S" )})
datos2<-reactive({ data.frame(datos(),NewDate() })
Then try using datos2()
in ggplot
- I think that should give you what you need.