1

我没有使用 CSV 数据。这会是个问题吗?每次我运行它都会显示找不到函数“prophet”或“make_future_dataframe”

这是我使用的数据

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)

然后会发生这种情况:

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)
4

1 回答 1

1

这已经被报告为先知中的一个问题,并建议从源代码安装软件包以修复它:

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

此外,请仔细检查两者是否prophet.so存在libtbb.dylib于您的系统中。

于 2021-01-11T09:56:51.697 回答