1

I'm following the guide Big Data Analytics with R. But the as.data.frame.ffdf function seems to be missing.

Does anyone have an idea? Or is there any alternative solution?

Here's sample code:

# Data were downloaded from Bureau of Transportation Statistics:
# http://www.transtats.bts.gov/DL_SelectFields.asp?Table_ID=236&DB_Short_Name=On-Time
library(Hmisc);library(ff);library(ffbase)
flights.ff <- read.table.ffdf(file = "flights_sep_oct15.txt",
                              sep = ",", VERBOSE = T,
                              header = T, next.rows = 100000,
                              colClasses = NA)
describe(as.data.frame.ffdf(flights.ff$DISTANCE))
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
  • You've probably already tried these, but I would try `update.packages()`, then re-run `install.packages("ff")` and `install.packages("ffbase")`. Then maybe try calling `ff::as.data.frame.ffdf()` explicitly? Assuming that function is exported from the `ff` package – Captain Hat Apr 14 '21 at 14:38
  • 2
    It is *not* exported, it is registered as an S3 method for `as.data.frame`. You should be able to do just `as.data.frame(.)` on an `ffdf`-classes object for it to work. If you want to side-step this normal process, use `ff:::as.data.frame.ffdf(.)`. – r2evans Apr 14 '21 at 14:40
  • @r2evans @CaptainHat Thanks. Yes, I did try, but it didn't work. And `ff::as.data.frame.ffdf()` or `ffbase::as.data.frame.ffdf()` didn't work too. Like @r2evans said, it turned out `Error: 'as.data.frame.ffdf' is not an exported object from 'namespace:ff'`. However, `as.data.frame()` also threw out an error: `cannot coerce class ‘c("ff_vector", "ff")’ to a data.frame`. – Richard Bai Apr 14 '21 at 16:23
  • Did you try `ff:::as.data.frame.ffdf`? (Notice that I suggested three colons, you only reported trying two colons.) – r2evans Apr 14 '21 at 16:28
  • What happens when you do `as.data.frame(flights.ff)` (or `ff:::as.data.frame.ffdf(flights.ff)`? I'm not positive, but doesn't the frame inherit `ffdf` and the columns/vectors inherit `ff_vector`? – r2evans Apr 14 '21 at 16:31
  • @r2evans `ff::as.data.frame.ffdf(flights.ff)` got `Error: 'as.data.frame.ffdf' is not an exported object from 'namespace:ff'`. But `as.data.frame(flights.ff)` successfully generated `data.frame` object. So I tried `describe(as.data.frame(flights.ff)$DISTANCE)`, and it worked. I think you're right. The columns/vectors inherit `ff_vector`. Thanks! – Richard Bai Apr 14 '21 at 16:49
  • @RichardBai, you did it again, ***I'm using three colons***, it is a different thing. `::` (2) is to access objects that are exported, `:::` (3) gives access to unexported objects as well. I'm glad the canonical method `as.data.frame(flights.ff)` worked, you should stick with it. – r2evans Apr 14 '21 at 17:04
  • 1
    @r2evans Sorry, I didn't notice that. And `describe(ff:::as.data.frame.ffdf(flights.ff$DISTANCE))` does work well. Thanks again! – Richard Bai Apr 14 '21 at 17:14

0 Answers0