2015-11-19 31 views
5

嘗試首次運行fancyrpartplot並出現錯誤。r撥浪鼓fancyrpartplot錯誤

> fancyRpartPlot(rpart.sub1) 
Error in loadNamespace(name) : there is no package called ‘rpart.plot’ 

我已經搜索和搜索,但找不到解決方案。我嘗試刪除撥浪鼓和RGtk2,並繼續得到相同的錯誤。認爲它是與GTK +,但無法找到任何說明如何刪除並重新安裝GTK +

> remove.packages("RGtk2") 
Removing package from ‘C:/Program Files/R/R-3.1.0/library’ 
(as ‘lib’ is unspecified) 
> remove.packages("rattle") 
Removing package from ‘C:/Program Files/R/R-3.1.0/library’ 
(as ‘lib’ is unspecified) 

Restarting R session... 

> install.packages("rattle") 
also installing the dependency ‘RGtk2’ 

trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/RGtk2_2.20.31.zip' 
Content type 'application/zip' length 13914471 bytes (13.3 Mb) 
opened URL 
downloaded 13.3 Mb 

trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/rattle_4.0.0.zip' 
Content type 'application/zip' length 3728887 bytes (3.6 Mb) 
opened URL 
downloaded 3.6 Mb 

package ‘RGtk2’ successfully unpacked and MD5 sums checked 
package ‘rattle’ successfully unpacked and MD5 sums checked 

The downloaded binary packages are in 
    C:\Users\xxx\AppData\Local\Temp\RtmpsLxgOv\downloaded_packages 
> require(RGtk2) 
Loading required package: RGtk2 
Error in inDL(x, as.logical(local), as.logical(now), ...) : 
    unable to load shared object 'C:/Program Files/R/R-3.1.0/library/RGtk2/libs/x64/RGtk2.dll': 
    LoadLibrary failure: The specified module could not be found. 

In addition: Warning message: 
package ‘RGtk2’ was built under R version 3.1.3 
trying URL 'http://ftp.gnome.org/pub/gnome/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip' 
Content type 'application/zip' length 25830230 bytes (24.6 Mb) 
opened URL 
downloaded 24.6 Mb 

Learn more about GTK+ at http://www.gtk.org 
If the package still does not load, please ensure that GTK+ is installed and that it is on your PATH environment variable 
IN ANY CASE, RESTART R BEFORE TRYING TO LOAD THE PACKAGE AGAIN 
Warning messages: 
1: Failed to load RGtk2 dynamic library, attempting to install it. 
2: In dir.create(config_path, recursive = TRUE) : 
    'C:\Program Files\R\R-3.1.0\library\RGtk2\gtk\x64\etc\gtk-2.0' already exists 
> require(rattle) 
Loading required package: rattle 
Rattle: A free graphical interface for data mining with R. 
Version 4.0.0 Copyright (c) 2006-2015 Togaware Pty Ltd. 
Type 'rattle()' to shake, rattle, and roll your data. 
Warning message: 
package ‘rattle’ was built under R version 3.1.3 
> fancyRpartPlot(rpart.sub1) 
Error in loadNamespace(name) : there is no package called ‘rpart.plot’ 

有趣的是,它說缺少C:/Program Files/R/R-3.1.0/library/RGtk2/libs/x64/RGtk2.dll的文件實際上是存在的,我已經人工檢查。

在這一點上我已經幾次刪除撥浪鼓和RGtk2。每次RGtk2再次安裝GTK +,但沒有任何變化。

任何幫助非常感謝。

編輯:應該有可能補充說,如果我輸入rattle()撥號似乎正確加載。

+4

安裝軟件包rpart和rpart.plot – phiver

+0

@phiver'plot(rpart.sub1)'正確繪製了rpart創建的樹,所以我知道rpart和rpart.plot都安裝並正常工作。 –

+1

@SC。 plot(rpart.sub1)並不意味着rpart.plot可用。它只是繪製了rpart.sub1。使用rpart.plot進行繪圖意味着使用命令prp(或rpart.plot :: prp(rpart.sub1) – phiver

回答

5

每@phiver rpart.plot失蹤

1

根據警告不要 「在loadNamespace(名)錯誤:沒有包稱爲 'rpart.plot'」,鍵入:install.packages(「rpart包。情節」)。