Python输出未使用R中的网状包以html显示
我有一个R脚本代码,如下所示,对于在html文件中显示eval表达式输出的R命令,它工作得很好,但是当我用计算python文件的R命令替换表达式时,它在控制台上显示输出,而不是在html文件中Python输出未使用R中的网状包以html显示,python,r,shiny,reticulate,Python,R,Shiny,Reticulate,我有一个R脚本代码,如下所示,对于在html文件中显示eval表达式输出的R命令,它工作得很好,但是当我用计算python文件的R命令替换表达式时,它在控制台上显示输出,而不是在html文件中 listfile<-"temp.html" listcon <- file(listfile, "w") sink(listcon, append = TRUE, type = "output", split = split) eva
listfile<-"temp.html"
listcon <- file(listfile, "w")
sink(listcon, append = TRUE, type = "output", split = split)
eval(parse(text="py_run_file('code.py')")) # This line now shows the output in console but not in the browser
close(listcon)
下面是有效的脚本
listfile<-"temp.html" # Create temp.html file in current directory
listcon <- file(listfile, "w")
sink(listcon, append = TRUE, type = "output", split = split)
eval(parse(text="print('hello')")) # Evaluate the expression and shows the output on html file
close(listcon)
我的文件夹结构如下:
|
|- script.R
|- code.py
|- temp.html
谢谢你的时间和建议
|
|- script.R
|- code.py
|- temp.html