是否可以在 R闪亮中运行Python脚本

2024-03-27

我有一些格式奇怪的数据集,并编写了一些 python 脚本来转换为 csv 格式以在 R 中使用。是否可以在 R 闪亮应用程序中调用 python 脚本?


这是一个最小的 Shiny 应用程序,它使用rPython执行 python 调用。

library(shiny)
library(rPython)

ui = bootstrapPage(
  sliderInput('x', 'Set x', 0, 10, 5),
  verbatimTextOutput('out1')
)

server = function(input, output, session){
  output$out1 <- renderPrint({
    python.call("len", 1:input$x)
  })
}

runApp(list(ui = ui, server = server))
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

是否可以在 R闪亮中运行Python脚本 的相关文章

随机推荐