Dear all, My name is Jackson. I am trying to set the same colour range for 2 rasters (max and min temperatures). Both rasters have different numerical ranges but the same dimensions dimensions : 4346, 4365, 18970290, 1 (nrow, ncol, ncell, nlayers)
The lowest value is 3 and the highest is 31. So my colour palette should range from 3 to 31 and be useful for both temperatures However I got a message saying that S4 and vector cannot be coerced. So far I understand why it is not working but how to fix it? A few lines from my code. #### cols<-colorRampPalette(c("royalblue","springgreen","yellow","orange","red"))(29) Temp.interval = seq(from=3, to=31) # creating colour vectors col1 <- cols[findInterval(TMin_masked$prj, vec = Temp.interval )] Error in as.double(x) : cannot coerce type 'S4' to vector of type 'double' #### Thank you all! Best regards. Jackson [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.