无效的下标类型 'list' Azure 机器学习

invalid subscript type 'list' Azure Machine Learning

问题

我在 Azure 机器学习中部署了我的实验作为 Web 服务。实验运行没有错误。

但是在使用 REQUEST/RESPONSE 进行测试时,出现以下错误:

Execute R Script Piped (RPackage) : The following error occurred during evaluation of R script: R_tryEval: return error: Error in split(df, list(df$PRO_NAME, df$Illness_Code))[Ind] : invalid subscript type 'list'

这是代码:

# Loop through the dataframe and apply model
Ind <- sapply(split(df, list(df$PRO_NAME,df$Illness_Code)), 
              function(x)nrow(x)>1)

out <- lapply(
    split(df, list(df$PRO_NAME, df$Illness_Code))[Ind],
    function(c){
        m <- lm(formula = COUNT ~ YEAR, data = c)
        coef(m)
    })

固定

问题:

如果输入数据有限(例如,仅 1-2 行),某些 R 代码将不起作用

解法:

Batch 而非 REQUEST/RESPONSE

加载数据