0

我在工作时使用 ReporteRs 包没有任何问题,但在家里我却遇到了问题。如果我尝试使用包中的示例代码:

require(rJava)
require(ReporteRs)
require( ggplot2 )
.jinit()
doc = docx( title = 'My document' )
doc = addTitle( doc , 'First 5 lines of iris', level = 1)
doc = addFlexTable( doc , vanilla.table(iris[1:5, ]) )
doc = addTitle( doc , 'ggplot2 example', level = 1)
myggplot = qplot(Sepal.Length, Petal.Length, data = iris, color = Species, size = Petal.Width )
doc = addPlot( doc = doc , fun = print, x = myggplot )
doc = addTitle( doc , 'Text example', level = 1)
doc = addParagraph( doc, 'My tailor is rich.', stylename = 'Normal')
filename <- tempfile(fileext = ".docx") # the document to produce
writeDoc( doc, filename )

我收到以下错误:

Error in .jcall(doc$obj, "[S", "getStyleNames") : 
  java.io.IOException: The system cannot find the path specified

我没有使用java的经验,所以我不确定如何解决这个问题。如果有帮助,doc$obj 会返回:“Java-Object{org.lysis.reporters.docs.docx4R@2353354a}”

4

0 回答 0