Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Error in .local(x, values, ...) :
- values must be numeric, integer or logical.
- inR <- 'D://test/TS_combined_clipped.tif'
- outR <- 'D://test/R_test3.tif'
- rasterB <- brick(inR)
- fun1 <-function(x){
- years = c(1972,1973,1974,1975,1984,1984)
- na_idx = which(is.na(x))
- years = years[-na_idx]
- x <- na.omit(x)
- idx = detectChangePoint(x, cpmType='Student', ARL0=500)$changePoint
- return(years[idx]) # this raises error
- # print(years[idx]) # This does *not* raises any error
- }
- r <- calc(rasterB, fun=fun1, filename=outR, overwrite=TRUE)
Add Comment
Please, Sign In to add comment