[R-pkg-devel] Question "no visible binding for '<<-' assignment"

Federico Zanghi |eder|co@z@ngh|@11 @end|ng |rom gm@||@com
Wed Apr 14 18:11:39 CEST 2021


Hi :)

I'm here because i have a problem with my package...i have the function
"SARMAX.refinement", clearly the problem is that i can't assign a variable
on global environment from a function.
So when i CHECK the package it gives me 1 Note that doesn't make me publish
the package :(

The Note is this:

* checking R code for possible problems ... [20s] NOTE
SARMAX.refinement: no visible binding for '<<-' assignment to 'xreg'


The fact is that the function
"model <- Arima(fit$data, order = arima_order,seasonal =
list(order=seasonal_order,period=period), xreg = xreg)"

works only if i define xreg on the glob.env...

I tried  using fitted(fit) instead of xreg but i cannot use predict because
the function doesn't find "fitted(fit)" or xreg (even if i define xreg only
inside the function with xreg <- fitted(fit)).

Anyone has any suggestions?
(without completely change the function or the class...i'd like to
maintain the current class to use all its functions)

Thank you,
Federico



P.S.

In order to being as clear as possible i paste the code i need to use:

arimaGGM <- SARMAX.refinement(GGM,arima_order = c(2,0,1),seasonal_order =
c(1,0,0), period=4,display = F)
predict(arimaGGM,newxreg = 1:100)

the data is also attached to the mail :)


More information about the R-package-devel mailing list