R允许解析XML文件吗?
我在R-shinny的server.R脚本的renderPlot函数中解析上传的XML文件R允许解析XML文件吗?,r,xml,parsing,shiny,R,Xml,Parsing,Shiny,我在R-shinny的server.R脚本的renderPlot函数中解析上传的XML文件 output$oscar <- renderPlot({ doc <- xmlParse("www/Human_body_front_and_side.svg.eps.xml") #load the XML as a picture body<-readPicture(saveXML(doc)) #plot it grid.arrange(pictureGrob(body), nco
output$oscar <- renderPlot({
doc <- xmlParse("www/Human_body_front_and_side.svg.eps.xml")
#load the XML as a picture
body<-readPicture(saveXML(doc))
#plot it
grid.arrange(pictureGrob(body), ncol=1)
})
我已经加载了正确的库(shinny
,XML
),并检查上传的XML文件是否正常
有趣的是,如果在启动R-Shining的“runApp”之前,我在R终端中执行以下操作:
doc <<- xmlParse("Human_body_front_and_side.svg.eps.xml")
docui.R:
服务器.R
library(shiny)
library(XML)
library(grImport)
library(gridExtra)
# Define server logic to draw a histogram
shinyServer(function(input, output){
output$humanBody <- renderPlot({
doc <- readPicture("./www/Human_body_front_and_side.svg.eps.xml")
grid.arrange(pictureGrob(doc), ncol=1)
})
})
库(闪亮)
库(XML)
图书馆(格里姆波特)
图书馆(gridExtra)
#定义服务器逻辑以绘制直方图
shinyServer(功能(输入、输出){
输出$humanBodyui.R:
服务器.R
library(shiny)
library(XML)
library(grImport)
library(gridExtra)
# Define server logic to draw a histogram
shinyServer(function(input, output){
output$humanBody <- renderPlot({
doc <- readPicture("./www/Human_body_front_and_side.svg.eps.xml")
grid.arrange(pictureGrob(doc), ncol=1)
})
})
库(闪亮)
库(XML)
图书馆(格里姆波特)
图书馆(gridExtra)
#定义服务器逻辑以绘制直方图
shinyServer(功能(输入、输出){
输出$humanBody文件不在正确的文件夹中如果我的R-Shining应用程序名为“test”,我将该xml文件保存在“test/www”中,并使用doc remove app folder(test)调用它从路径上看,如果我用doc调用它,这意味着该文件位于正确的文件夹中,但格式不正确该文件不在正确的文件夹中如果我的R-Shining应用程序名为“test”,我将该xml文件保存在“test/www”中,并用doc remove app folder(test)调用它从路径中,如果我用doc调用它,这意味着该文件位于正确的文件夹中,但格式不正确谢谢您的帮助。您可以在那里找到xml文件。我添加了一些服务器的详细信息。我的问题的R。我用books.xml尝试了我的代码,但得到了“参数长度为零”在步骤Body中,您使用哪个包提供readPicture()函数?该包是grImport,用于绘制postscript图像。事实上,我稍后使用函数“xpathSApply”和“xmlAttrs”更改人体某些部位的颜色。这是一种魅力。谢谢Valter!谢谢你的帮助。你可以在那里找到xml文件。我添加了一些服务器的详细信息。我的问题的R。我尝试使用books.xml编写代码,但得到“参数长度为零”在步骤body中,您使用哪个提供readPicture()函数的软件包?该软件包是grImport,旨在绘制postscript图像。事实上,我后来使用grImport的函数“xpathSApply”和“xmlAttrs”来更改人体某些部位的颜色。它很有魅力。谢谢Valter!
library(shiny)
library(XML)
library(grImport)
library(gridExtra)
# Define server logic to draw a histogram
shinyServer(function(input, output){
output$humanBody <- renderPlot({
doc <- readPicture("./www/Human_body_front_and_side.svg.eps.xml")
grid.arrange(pictureGrob(doc), ncol=1)
})
})