0

I'm trying to use the function colorRampPalette in the newest R software 3.6.2. When I try to install it I get the warning message that this package is not available for this version of R. This is the palette I want

scale_colour_gradientn(name=variable,
                                    colours=colorRampPalette(rev(c("red","yellow","springgreen","royalblue")))(50),
                                    na.value="white")}

Does anyone have a suggestion for an equivalent function. Or another way to get this package?

Kristen Cyr
  • 629
  • 5
  • 16
  • 3
    `colorRampPalette` is part of the base r packages, so it should be the correct version when you install r--are you sure it's not complaining about ggplot/`scale_colour_gradientn`? also I don't think you need `colorRampPalette` in this code since `scale_colour_gradientn` is performing color interpolation so it seems like you're doing it twice with `colorRampPalette` – rawr Jan 24 '20 at 18:37
  • I did uninstall the tool grDevices, because it wasn't working another package I need for a function I'm using. Are you saying I could write the code like this instead ```scale_colour_gradientn(name=variable, colours= rev(c("red","yellow","springgreen","royalblue")))(50), na.value="white")}``` – Kristen Cyr Jan 24 '20 at 18:39
  • 3
    yes but without the `(50)` you shouldn't need to install/re-install the base packages, i think you are in area 5 or 6 of [this question](https://stackoverflow.com/a/25721890/2994949) where you have r packages that were built under older versions of r, and your newer r/grDevices/colorRampPalette need a re-installed ggplot/etc – rawr Jan 24 '20 at 18:53
  • 1
    I think you need to go back and look at the problem that you think you solved by uninstalling `grDevices`. It's generally not a good idea to remove default packages. Most R functions assume they are available and might break without them. What was the original problem? – MrFlick Jan 24 '20 at 20:01
  • I was trying to use marmap.... and it won't load if grDevice is loaded – Kristen Cyr Jan 25 '20 at 02:13

0 Answers0