Hi there.
I encountered an issue that puzzled me while trying to save an R dataset
data to re-open in Gretl from inside foreign {} end foreign
gretl.export(x) saves in .csv but loses information (column and rows, keeps
only the central data). I tried many set.
As an example, the native AirPassengers dataset:
/* ------------ script ----------------*/
set R_functions on
foreign language=R
library(ggplot2)
library(ggfortify)
library(remotes)
autoplot(AirPassengers)
p<-autoplot(AirPassengers, ts.colour = 'blue')
p + ggtitle('AirPassengers') + xlab('Year') + ylab('Passengers')
data <- as.matrix(AirPassengers) #fails
gretl.export(data)
#data <- data.frame(AirPassengers)
#save(data, file = "C:/User/USUARIO/AppData/Roaming/gret/AirPassengers.csv")
#gretl.export(AirPassengers) #fails
#write.csv(AirPassengers, file =
"C:/Users/USUARIO/AppData/Roaming/gret/AirPassengers.csv", sep=";" ,
dec=
",", append=FALSE, row.names=TRUE) #fails
#write.csv(AirPassengers, file =
"C:/User/USUARIO/AppData/Roaming/gret/AirPassengers.csv", row.names=FALSE,
quote=FALSE) #fails
#write_xlsx also fails
end foreign
open C:/Users/USUARIO/AppData/Roaming/gretl/AirPassengers.csv #opens set
in gretl
/*-----------------------------------*/
Only gretl.export SAVES to disk. But saves the wrong data.
I am attaching what the set should look like.
Anyone knows how to work around this?
Many thanks
Tony