Dear List members, I am trying to map the habitat suitability of Nephrops and one of my predictor is a categorical variable.
However when I utilised the command "as.factor" (before to create my rasters stack) I get the error message "Error in 1:ncol(r) : argument of length 0". Could anyone help me? > r4 <- > raster("C:/POSTDOC/NEPHROPS_Habitat_Mapping/NEPHROPS_HabMod_PAPER1/Scotland/IN_eunis_sed.tif") > plot(r4) > is.factor(r4) [1] TRUE > as.factor(r4) class : RasterLayer dimensions : 250, 413, 103250 (nrow, ncol, ncell) resolution : 0.01484784, 0.01484784 (x, y) extent : -7.774709, -1.642552, 54.95371, 58.66567 (xmin, xmax, ymin, ymax) coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 data source : C:\POSTDOC\NEPHROPS_Habitat_Mapping\NEPHROPS_HabMod_PAPER1\Scotland\IN_eunis_sed.tif names : IN_eunis_sed values : 1, 6 (min, max) attributes : Error in 1:ncol(r) : argument of length 0 > levels(r4) [[1]] ID OBJECTID Value Count sediment 0 1 1 2716 R 1 2 2 2249 CS 2 3 3 2647 MS 3 4 4 6819 M 4 5 5 889 MXS 5 6 6 3647 S Thank you very much in advance. Best Regards, Valentina [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.