Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with byte compiler in R 3.4 #209

Closed
christophsax opened this issue Apr 30, 2017 · 3 comments
Closed

Problem with byte compiler in R 3.4 #209

christophsax opened this issue Apr 30, 2017 · 3 comments

Comments

@christophsax
Copy link
Owner

christophsax commented Apr 30, 2017

I R 3.4, I got the following error, when calling outlier twice.

library(seasonal)
m <- seas(AirPassengers)
outlier(m)
outlier(m)
# Error in stats::window(x = `*tmp*`, start = as.numeric(ol.time.R[[i]]),  : 
#    object '*tmp*' not found

Narrowing it down a bit it turns out this is probably caused by the new byte compiler which is turned on by default. So, here's the pure R problem:

z <- AirPassengers

# this works
window(z, start =  c(1955, 1), end =  c(1955, 1)) <- NA

# this works not
for (i in 1) {
 window(z, start =  c(1955, 1), end =  c(1955, 1)) <- NA
}
# Error in stats::window(x = `*tmp*`, start = c(1955, 1), end = c(1955,  : 
#   object '*tmp*' not found


# turning off the byte compiler makes it working again
compiler::enableJIT(0)
for (i in 1) {
 window(z, start =  c(1955, 1), end =  c(1955, 1)) <- NA
}

If disabled before loading seasonal, this also fixes with the outlier problem:

compiler::enableJIT(0)
library(seasonal)
m <- seas(AirPassengers)
outlier(m)
outlier(m)
@christophsax christophsax changed the title Problem with bye compiler in R 3.4 Problem with byte compiler in R 3.4 Apr 30, 2017
@eddelbuettel
Copy link
Collaborator

Hairy. Suggest you post on r-devel.

@christophsax
Copy link
Owner Author

Seems to be a R 3.4.0 issue. As a workaround, I got rid of the loop in outlier(). Should be also slightly more elegant now.

@eddelbuettel
Copy link
Collaborator

Nice. I clearly don't use Map() enough myself. And I saw Tomas' follow-up so I guess you were just bitten by a regular garden-variety bug ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants