1

I'm not using CSV data. Is that will be a problem? Every time I run this it will be shown couldn't find function "prophet" or "make_future_dataframe"

This is the data i use

resp_jakarta <- GET("https://data.covid19.go.id/public/api/prov_detail_DKI_JAKARTA.json")
status_code(resp_jakarta)
cov_jakarta_raw <- content(resp_jakarta, as = "parsed", simplifyVector = TRUE)
cov_jakarta <- cov_jakarta_raw$list_perkembangan

new_cov_jakarta <-
  cov_jakarta %>%
  select(-contains("DIRAWAT_OR_ISOLASI")) %>% 
  select(-starts_with("AKUMULASI")) %>% 
  rename(
    kasus_baru = KASUS,
    meninggal = MENINGGAL,
    sembuh = SEMBUH
  ) %>% 
  mutate(
    tanggal = as.POSIXct(tanggal / 1000, origin = "1970-01-01"),
    tanggal = as.Date(tanggal)
  )
    #Forecast
    install.packages("prophet")
trying URL https://cran.rstudio.com/bin/macosx/contrib/4.0/prophet_0.6.1.tgz
Content type 'application/x-gzip' length 6317112 bytes (6.0 MB)

downloaded 6.0 MB


The downloaded binary packages are in
    /var/folders/bl/q861y47s7b7cnym8hzmryv0c0000gn/T//RtmpTKLo8z/downloaded_packages

    library(prophet)
This happens when i run library(prophet)

Loading required package: Rcpp

Loading required package: rlang

Error: package or namespace load failed for ‘prophet’ in dyn.load(file,   DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/prophet/libs/prophet.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/prophet/libs/prophet.so, 6): Library not loaded: @rpath/libtbb.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/prophet/libs/prophet.so
  Reason: image not found
    
    date=as.Date(new_cov_jakarta$tanggal)
    cases=new_cov_jakarta$kasus_baru
    temp_prophet <- data.frame(date,cases)
    temp_prophet <- temp_prophet %>% rename(ds = date, y = cases)
    
    #Issues start from here
    m <- prophet(temp_prophet)

And then this happens:

Error in prophet(temp_prophet) : could not find function "prophet"

    future <- make_future_dataframe(m, periods = 30,freq="day")

Error in make_future_dataframe(m, periods = 30, freq = "day") : could not find function "make_future_dataframe"

tail(future)
forecast <- predict(m, future)
Phil
  • 7,287
  • 3
  • 36
  • 66
  • It sounds like you're having trouble importing a package. This is probably because you haven't installed the package. https://facebook.github.io/prophet/docs/installation.html#r says to run `install.packages('prophet')` :) Have you tried that? Maybe you ran it in the wrong directory? – compiledweird Dec 29 '20 at 06:43
  • 1
    i already installed it but when i run library(prophet) it will be shown Error: package or namespace load failed for 'prophet' in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/Library/Frameworks/R. framework/ Versions/4 . 0/Resources/library /prophet/libs/prophet . so' : dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/prophet/libs/prophet .so, 6): Library not loaded: @rpath/li btbb.dylib Referenced from: /Library/Frameworks/R. framework/Versi ons / 4. 0/Resources/library/ prophet/libs/prophet . so Reason: image not found – user14905055 Dec 30 '20 at 03:06
  • That stack trace is very useful. Can you add that stack trace plus the rest of the stack trace it to the main question? It sounds like your problem is indeed that the place you installed prophet is not reachable by the place where you are running your R – compiledweird Dec 30 '20 at 17:10
  • 1
    i already edit it. i hope that helps. thankyou for your respond! – user14905055 Dec 31 '20 at 02:46
  • AFAIK, prophet pakage wraps around Stan statistical platform, which should be installed in your system. Seems you have problems with it. Check the installation guide here https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started – inscaven Jan 11 '21 at 10:02
  • oh ok thankyou for your help! – user14905055 Jan 20 '21 at 15:37

1 Answers1

1

That's already been reported as an issue in prophet, and was suggested to install the package from source in order to fix it:

install.packages("prophet", type="source")

Also, double-check that both prophet.so and libtbb.dylib exist in your system.

ssayols
  • 790
  • 6
  • 10
  • This is the acceptable answer. Not sure last time you installed it, but I just did for the first time from CRAN and there was a message suggesting I install the source version. "There is a binary version available but the source version is later: binary source needs_compilation rstan 2.21.1 2.21.2" – Jessica Burnett Jan 12 '21 at 16:02
  • @user14905055 did installing prophet from source solved the issue? May I kindly ask you to provide some feedback, and either accept the answer, or share what did not work? – ssayols Jan 25 '21 at 22:06