Ubuntu xlsx package cannot set values

I run the following script

library(xlsx); wb <- loadWorkbook("/home/.../MyFile.xlsx") #works fine sh <- getSheets(wb) #works fine rw <- getRows(sh[[1]]) #-works fine rc <- getCells(rw) # works fine v <- lapply(rc, getCellValue) # works fine v['21.4'] #works fine, returns the correct value setCellValue(rc['21.4'], 'Hallo') #fails Error in .jcall(cell, "V", "setCellValue", value) : java.lang.ClassNotFoundException 

after repeating the command

 Error in .jcall(cell, "V", "setCellValue", value) : RcallMethod: cannot determine object class 

This happens in RStudio and in the classic R-terminal under Ubuntu 12.04 32Bit. Please, help!

+4
source share
1 answer

I have the same problem on Windows 7 x64 and I think there is an error in the "xlsx" documentation. However instead

 setCellValue(rc['21.4'], 'Hallo') 

to try

 setCellValue(rc[['21.4']], 'Hallo') 

Worked for me. Kuba

+3
source

Source: https://habr.com/ru/post/1436322/


All Articles