Azure机器学习执行R脚本 - 找不到函数“rowid”错误

问题描述 投票:0回答:1

我试图在Azure ML工作室中运行以下R脚本,将数据帧从长格式转换/重新整形(example)。我的脚本在Rstudio中运行得很好。但同样不会在Azure ML工作室中运行并抛出以下错误 - 无法找到函数“rowid”。很高兴知道我怎么能摆脱这个以及究竟是什么造成了这个错误,尽管它足以在Rstudio中整齐地运行。

#loading all libraries in Azure ML environment
x <- c('plyr','reshape2','data.table','reshape') 
lapply(x, library, character.only = TRUE)

#Map 1-based optional input ports to variables
cross_sell <- maml.mapInputPort(1) # class: data.frame
#sample maml.mapInputPort(1) output looke like this - 
#cross_sell <- data.table(Order.number c('01234567','03221345','01234567'), Art_name = c('cheese','choc','cheese'))

xx_cross_sell <- as.data.frame(dcast(setDT(cross_sell),Order.number ~ rowid(Order.number, prefix = "Article"), value.var = "Art.name"))
cross_sell_tf <- as.data.frame(xx_cross_sell[,2:7])

#Error: Error 0063: The following error occurred during evaluation of R script:
# ---------- Start of error message from R ----------
      could not find function "rowid"
# ----------- End of error message from R -----------

我试过R版本CRAN R 3.1.0和Microsoft R open 3.2.2中的代码。非常感谢你提前。

r dplyr data.table azure-machine-learning-studio azure-machine-learning-workbench
1个回答
1
投票

嗨,我在2天前遇到了同样的问题,功能pull(),总是包dplyr。问题是Azure Machine Learning Studio支持的R版本(CRAN R 3.1.0和Microsoft R open 3.2.2)不支持0.7.4软件包的版本dplyr。如果您阅读与documentation软件包相关的dplyr,您会发现该软件包仅适用于R版本> = 3.1.2。

然后,您必须等待Azure Machine Learning Studio使用的R版本更新,或者找到您的功能的替代解决方案。

© www.soinside.com 2019 - 2024. All rights reserved.