我在 R XLConnect 中运行,想要调用用户制作的公式,而不是原生 XL 公式。
form=paste('"gdp.q_n"','"2006"','"2014"',0,'"Quarterly"',sep=",")
form=paste("FAMEDate(",form,")",sep="")
setCellFormula(object=wb,sheet=sht,row=2,col=2,formula=form)
>Error: FormulaParseException (Java): Name 'FAMEData' is completely
unknown in the current workbook
如果我将它写在工作簿中并在 getCellFormula 中调用它,那么它会以对象形式返回相同的公式,但前缀为“!”,即
paste("!",form)
当我尝试将其放入 setCellFormula 时,它会返回一个不同的错误
>Error: FormulaParseException (Java): Parse error near char 0 '!'
in specified formula. Expected cell ref or constant literal
有什么建议么?