gpt4 book ai didi

python - 是否可以在 R shiny 中运行 python 脚本

转载 作者:太空狗 更新时间:2023-10-29 21:31:36 26 4
gpt4 key购买 nike

我有一些格式奇怪的数据集,并编写了一些 python 脚本以转换为 csv 格式以在 R 中使用。是否可以在 R shiny 应用程序中调用 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))

关于python - 是否可以在 R shiny 中运行 python 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24901021/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com