-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
It took me a long time to figure out how to replicate the forecast from stockassessment.org exactly on a pc. Maybe it is possible to include the line RNGkind(sample.kind = "Rounding") to the standard forecast script to make it robust to both pc and stockassessment.org. But an alternative is to allow users to download the forecast object directly from stockassessment.org.
I have adapted the fitfromweb function to do this (below). Is this something you would consider including in the package?
forecastfromweb <- function (stockname, character.only = FALSE, return.all = FALSE)
{
if (!character.only)
stockname <- as.character(substitute(stockname))
con <- url(sub("SN", stockname, "https://stockassessment.org/datadisk/stockassessment/userdirs/user3/SN/run/forecast.RData"))
e <- new.env()
nam <- load(con, e)
close(con)
if (return.all)
return(e)
hasFC <- grepl("^FC$", nam)
if (!any(hasFC)) {
warning(sprintf("No object named FC. Found %s in model.RData.",
paste0(nam, collapse = ", ")))
return(NA)
}
else if (length(nam) > 1) {
message(sprintf("Not returning %s from model.RData",
paste0(nam[!hasFC], collapse = ", ")))
}
return(e$FC)
}
Metadata
Metadata
Assignees
Labels
No labels