0

我尝试运行下一个代码:

doc.plot <- addPlot(doc = doc.plot,
                    fun = function() plot(Boruta.plot,las=2,
                                          xlim = c(55,65)),
                    vector.graphic = TRUE)

但是,Rstudio 有致命错误。xlim = c(55,65)是问题代码,因为没有这部分绘图功能。记者版本 0.8.6。请帮助修复此错误。

4

1 回答 1

0
# Wrtie example for reporteRs crush
library(Boruta)
library(ReporteRs)

# Create example data
fact <- as.factor(c(rep(x = rbinom(50,1,0.5),2)))
A <- rnorm(length(fact))
B <- rlnorm(length(fact))
C <- as.factor(rbinom(length(fact),size = 20,0.75))
example.data <- data.frame(fact,A,B,C)
example.boruta <- Boruta(fact~., example.data)
plot(example.boruta, las =2)

sessionInfo()
# R version 3.3.1 (2016-06-21)
# Platform: x86_64-w64-mingw32/x64 (64-bit)
# Running under: Windows >= 8 x64 (build 9200)
# 
# locale:
#   [1] LC_COLLATE=Russian_Russia.1251  LC_CTYPE=Russian_Russia.1251    LC_MONETARY=Russian_Russia.1251
# [4] LC_NUMERIC=C                    LC_TIME=Russian_Russia.1251    
# 
# attached base packages:
#   [1] stats     graphics  grDevices utils     datasets  methods   base     
# 
# other attached packages:
#   [1] ReporteRs_0.8.6     ReporteRsjars_0.0.2 Boruta_5.0.0        ranger_0.5.0       
# 
# loaded via a namespace (and not attached):
#   [1] Rcpp_0.12.6       png_0.1-7         digest_0.6.9      mime_0.5          R.methodsS3_1.7.1 R6_2.1.2         
# [7] xtable_1.8-2      gdtools_0.0.7     R.oo_1.20.0       R.utils_2.3.0     xml2_1.0.0        tools_3.3.1      
# [13] shiny_0.13.2      httpuv_1.3.3      htmltools_0.3.5   rJava_0.9-8       rvg_0.1.0         knitr_1.13  

# Save use ReporteRs
doc <- NULL
doc <- docx(title = 'Crash Boruta')
doc <- addParagraph(doc, 'Example')
doc <- addPlot(doc = doc,
               fun = function()
                 plot(example.boruta,
                    las=2,
                    xlim = c(4,6)),
               vector.graphic = TRUE)
writeDoc(doc = doc, 'example crash boruta.docx') # Its worked

doc <- NULL
doc <- docx(title = 'Crash Boruta')
doc <- addParagraph(doc, 'Example')
doc <- addPlot(doc = doc,
               fun = function()
                 plot(example.boruta,
                      las=2,
                      xlim = c(3,6)),
               vector.graphic = TRUE)

            ###
            ###
            ###
          ##   ##
        ##      ##
      ##         ##
      ## he hanged##
      ##  himself ##
       ##       ##
        ##     ##
         ##   ##
          ####
于 2016-07-22T10:02:00.980 回答