2013-12-20 73 views
2

我想改變R.啓動的調色板因此我複製下面的源代碼,以我的.Rprofile如何設置調色板中.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) 
)) 

R上的啓動以下消息顯示:

Error: Could not fine the function 'palette'

是否無法在啓動時更改調色板?

+0

'之前,也許加上'庫(grDevices)? –

+0

這會在啓動時打開一個煩人的窗口。在.Rprofile之後加載哪些軟件包,以及它在哪裏定義? (在調用'palette()'之前,我從不必加載'grDevices') –

回答

5

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

所以不是palette(),叫grDevices::palette()。 (是需要dev.off()調用消除空圖形窗口即以其他方式存在以下啓動。)

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() 
相關問題