R:xlsx (0.4.2) 包的 rJava 错误 [英] R: rJava error with xlsx (0.4.2) package

查看:29
本文介绍了R:xlsx (0.4.2) 包的 rJava 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 xlsx 包将来自外部文件的信息填充到电子表格中.到目前为止,我一直使用 addDataFrame() 将信息放入电子表格中,并且我尝试过的关于它的所有内容都成功(字体、颜色、边框等)

I am trying to use the xlsx package to fill a spreadsheet with information from an external file. Up until now, I have used addDataFrame() to put information into the spreadsheet, and everything about it that I have tried has been successful (fonts, colors, borders, etc.)

现在的问题是我需要有一列超链接,为此我需要获取或创建特定的单元格(我不确定是哪个,并且两者都给出了相同的错误).以下代码:

The issue now is that I need to have a column of hyperlinks, and to do that I need to get or create the specific cells (I'm not sure which, and both give the same error). The following code:

library(xlsx)
wb = createWorkbook(type="xlsx")
sheet = createSheet(wb, sheetName="InProduction")
createCell(1, 2)

产生错误:

.jcall 中的错误(row[[ir]], "Lorg/apache/poi/ss/usermodel/Cell;","createCell", : RcallMethod: 无法确定对象类

Error in .jcall(row[[ir]], "Lorg/apache/poi/ss/usermodel/Cell;", "createCell", : RcallMethod: cannot determine object class

经过一番摸索,我发现它试图调用的方法是 从此 API 调用:

After doing some poking around, I found the method it is trying to call is from this API with the call:

minColIx <- .jcall(row[[ir]], "T", "getFirstCellNum")

在我看来它应该起作用,但显然没有.任何人都可以对此有所了解吗?

Which seems to me like it ought to work, but it clearly doesn't. Can anyone shed some light on this?

提前致谢!

推荐答案

您需要先使用 createRowgetRows 创建行,然后才能使用 <在这些行中创建单元格代码>createCells.

You need to create rows using createRow or getRows before you can create cells in these rows using createCells.

这篇关于R:xlsx (0.4.2) 包的 rJava 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆