Closed eddelbuettel closed 8 years ago
Also, this is just wrong:
R> search() # x13binary loaded
[1] ".GlobalEnv" "package:readr" "package:gunsales" "package:x13binary" "tools:rstudio" "package:stats" "package:graphics"
[8] "package:grDevices" "package:utils" "package:datasets" "package:methods" "Autoloads" "package:base"
R> checkX13binary()
X-13ARIMA-SEATS Seasonal Adjustment Program
Version Number 1.1 Build 19
Execution began Jan 4, 2016 19.23.20
Reading input spec file from /tmp/RtmpmWFGkJ/Testairline.spc
Storing any program output into /tmp/RtmpmWFGkJ/Testairline.html
Storing any program error messages into /tmp/RtmpmWFGkJ/Testairline_err.html
WARNING: Visually significant seasonal and trading day peaks have
been found in the estimated spectrum of the regARIMA residuals.
WARNING: At least one visually significant trading day peak has been
found in one or more of the estimated spectra.
Execution complete for /tmp/RtmpmWFGkJ/Testairline.spc at Jan 4, 2016 19.23.20
X-13 has run successfully
R> analysis()
No path to the binary executable of X-13 specified.
For installation details, consider Section 2 of the package vignette:
http://cran.r-project.org/web/packages/seasonal/vignettes/seas.pdf
Hide Traceback
Rerun with Debug
Error in checkX13(fail = TRUE, fullcheck = FALSE, htmlcheck = FALSE) :
Process terminated
11 stop("Process terminated")
10 checkX13(fail = TRUE, fullcheck = FALSE, htmlcheck = FALSE)
9 seas(.)
8 function_list[[i]](value)
7 freduce(value, `_function_list`)
6 `_fseq`(`_lhs`)
5 eval(expr, envir, enclos)
4 eval(quote(`_fseq`(`_lhs`)), env, env)
3 withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
2 total %>% seas %>% final at main.R#66
1 analysis()
R>
system.file("bin", package="x13binary")
style. Will do it.Ah, the second is because seasonal is imported, instead of loaded. This skips the .onAttach()
function which sets the path. This currently won't work:
seasonal::seas(AirPassengers)
No path to the binary executable of X-13 specified.
For installation details, consider Section 2 of the package vignette:
http://cran.r-project.org/web/packages/seasonal/vignettes/seas.pdf
Error in checkX13(fail = TRUE, fullcheck = FALSE, htmlcheck = FALSE) :
Process terminated
I guess I need to put this check inside the seas()
function.
I usually use .onLoad()
not .onAttach()
but then I also don't have such fine-grained dependencies over multiple layers. We get this sorted out.
Also: We could abuse LinkingTo:
. It will also ensure package is present, but not load anything. Maybe an alternative?
I switched to .onAttach()
because CRAN tests don't want messages in .onLoad()
. But it should work now:
> seasonal::seas(AirPassengers)
Call:
seasonal::seas(x = AirPassengers)
Coefficients:
Weekday Easter[1] AO1951.May MA-Nonseasonal-01
-0.00295 0.01777 0.10016 0.11562
MA-Seasonal-12
0.49736
Yes you can have messages in .onLoad()
if you use packageStartupMessage()
or what it is called.
https://github.com/Rblp/Rblpapi/blob/master/R/init.R#L27-L29
Let's do this properly.
I got a NOTE saying I should read ?.onAttach
, where it said:
Loading a namespace should where possible be silent, with startup messages given by .onAttach. These messages (and any essential ones from .onLoad) should use packageStartupMessage so they can be silenced where they would be a distraction.
Ok, essential messages seem to be o.k.
works with onLoad.()
!
It only works after
library(x13binary)
which defeats the purpose.