2015-07-10 70 views
0

我試圖讀取使用grImport庫(http://cran.r-project.org/web/packages/grImport/vignettes/import.pdf) 這裏的ps.xml文件是我的代碼:readPicture功能(grImport包)不能在Linux上工作(F22)

require("gridBase") 
require("grImport") 
require("plotrix") 
petal <- readPicture("petal.ps.xml") 

這是錯誤我收到:

Error in if (x == 0) 1 else if (x == 1) 0 else x :                           
missing value where TRUE/FALSE needed   

這裏是我的會話信息

> sessionInfo() 
R version 3.2.0 (2015-04-16)                                
Platform: x86_64-redhat-linux-gnu (64-bit)                             
Running under: Fedora 22 (Twenty Two) 

locale: 
[1] LC_CTYPE=en_US.UTF-8  LC_NUMERIC=C    
[3] LC_TIME=en_US.UTF-8  LC_COLLATE=en_US.UTF-8  
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 
[7] LC_PAPER=en_US.UTF-8  LC_NAME=C     
[9] LC_ADDRESS=C    LC_TELEPHONE=C    
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C  

attached base packages: 
[1] grid  stats  graphics grDevices utils  datasets  methods 
[8] base  

other attached packages: 
[1] plotrix_3.5-12 grImport_0.9-0 XML_3.98-1.3 gridBase_0.4-7 

ŧ他相同的代碼工作在Linux F20與我同樣的問題掙扎,最終被其他平臺上的再生與PostScriptTrace的XML解決它下面的會話信息

> sessionInfo() 
R version 3.2.0 (2015-04-16)                                
Platform: x86_64-redhat-linux-gnu (64-bit)                             
Running under: Fedora 20 (Heisenbug) 

locale: 
[1] LC_CTYPE=en_US.UTF-8  LC_NUMERIC=C    
[3] LC_TIME=en_US.UTF-8  LC_COLLATE=en_US.UTF-8  
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 
[7] LC_PAPER=en_US.UTF-8  LC_NAME=C     
[9] LC_ADDRESS=C    LC_TELEPHONE=C    
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C  

attached base packages: 
[1] grid  stats  graphics grDevices utils  datasets  methods 
[8] base  

other attached packages: 
[1] plotrix_3.4-8 grImport_0.8-4 XML_3.96-1.1 gridBase_0.4-6 

回答

0

。比較兩個平臺上生成的文件時,我發現失敗的圖像文件缺少path/context/style元素中的屬性。我能夠手動添加缺少的屬性lineendlinemitrelinejoin並加載圖像。

我懷疑那些缺少的元素是某些grImport版本中問題的來源。