简体   繁体   中英

Assign value to variable in ff

I am working with a ff dataset (final_faf_data) because of the size of my database. I am trying to create a new variable dpy which has only only one value (365) for all rows. When I try the following cmd (similar to what I would do in a dataframe)

final_faf_data$dpy <- 365

I get the following error

Error in `[[<-.ffdf`(`*tmp*`, i, value = 365) : assigned value must be ff

So my question is how do I assign it? I tried

vmode(final_faf_data$dpy, 365)

But it gives "NULL"

Any insights would be much appreciated.

TIA, Krishnan

Some sample data to reproduce your issue

L3 <- LETTERS[1:3] fac <- sample(L3, 10, replace = TRUE) df1 <- data.frame(x = 1, y = 1:10, fac = fac) final_faf_data <- as.ffdf(df1)

Error messages given by the lines below are clear:

final_faf_data$dpy <- 365
final_faf_data$dpy <- as.ff(365)

Therefore, modify 365 accordingly:

final_faf_data$dpy <- as.ff(rep(365, times=nrow(final_faf_data)))`

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM