[R] Set the same colour range for 2 != rasters

Jackson Rodrigues j@ck@onmrodrigue@ @ending from gm@il@com
Mon Sep 17 05:03:20 CEST 2018

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  : 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.


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.


	[[alternative HTML version deleted]]

More information about the R-help mailing list