문제

I'd like to change the Color palette on startup of R. Thus I copied the following source-code to my .Rprofile

palette(c(
  "#2e3436"   # (Aluminium 6)
  , "#ef2929" # (Scarlet Red 1)
  , "#73d216" # (Chameleon 2)
  , "#3465a4" # (Sky Blue 2)
  , "#fcaf3e" # (Orange 1)
  , "#ad7fa8" # (Plum 1)
  , "#babdb6" # (Butter 1)
  , "#babdb6" # (Aluminium 3)
))

On startup of R the following message shows up:

Error: Could not fine the function 'palette'

Is it not possible to change the palette on startup?

도움이 되었습니까?

해결책

From ?Startup

Note that when the site and user profile files are sourced only the 'base' package is loaded, so objects in other packages need to be referred to by e.g. 'utils::dump.frames' or after explicitly loading the package concerned.

So instead of palette(), call grDevices::palette(). (The call to dev.off() is needed to eliminate the empty graphics window that is otherwise present following startup.)

grDevices::palette(c(
  "#2e3436"   # (Aluminium 6)
  , "#ef2929" # (Scarlet Red 1)
  , "#73d216" # (Chameleon 2)
  , "#3465a4" # (Sky Blue 2)
  , "#fcaf3e" # (Orange 1)
  , "#ad7fa8" # (Plum 1)
  , "#babdb6" # (Butter 1)
  , "#babdb6" # (Aluminium 3)
))

grDevices::dev.off()
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top