Convert ff object to data.frame file

I work with big matrix and ff package. I am loading an ff object and I want to use it to calculate crps (rating).

For example, I have ff_matrix (called Mat with 25 rows and 7303 columns), which is a rainfall forecast (7303 represents the number of days (about 20 years) and 25 - 25 rainfall simulations in one day). I also have ff_array with observations for these 20 years (called Obs and with values โ€‹โ€‹of 7303).

With ensembleBMA package, I want to calculate CRPS. I need to put ff_matrix and ff_array in the object "ensembleBMA" (actually it is data.frame).

For this code:

ensembleBMA(Mat,Obs)

I have this error:

Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) : cannot coerce class 'c("ff_matrix", "ff_array", "ff")' into a data.frame

I tried different options, for example:

as.data.frame(Mat)
as.matrix(Mat)
transform.ffdf(as.ffdf(Mat))

I always have errors like this:

Error in as.data.frame.default(Mat_Ptot_212_1) : cannot automatically convert class  'c("ff_matrix", "ff_array", "ff")' into a data frame (data.frame)

or

opening ff /tmp/RtmpWrlY4n/clone9d3376b435.ff Error in ff(initdata = initdata, length = length, levels = levels, ordered = ordered,  : write error

Does anyone have any ideas?

+4
1

ff_array data.frame:

Mat <- ff(1, vmode="double", dim=c(25, 7303))
as.data.frame(Mat[,])

ff_array ffdf data.frame:

 as.ffdf(Mat)[,]

as.data.frame(as.ffdf(Mat))

. , , as.ffdf, 7303 .

, as.data.frame.ff_array.

+2

All Articles