R 如何使用shinyFiles从我的服务器端或本地计算机上载数据集?
我想从我的服务器端(指向服务器端的链接)或本地机器上传文件,然后数据集将被处理以进行一些可视化。有没有办法从我的简单代码这里可以更新上传文件从我的服务器端或本地机器。目前我的代码只能从本地机器上传,如下所示: 用户界面 服务器.RR 如何使用shinyFiles从我的服务器端或本地计算机上载数据集?,r,shiny,rshiny,R,Shiny,Rshiny,我想从我的服务器端(指向服务器端的链接)或本地机器上传文件,然后数据集将被处理以进行一些可视化。有没有办法从我的简单代码这里可以更新上传文件从我的服务器端或本地机器。目前我的代码只能从本地机器上传,如下所示: 用户界面 服务器.R ############################################################ ############## Datasets in and out ######################### ######
############################################################
############## Datasets in and out #########################
############################################################
# loading data
data <- eventReactive(input$file, {
extension <- tools::file_ext(input$file$name)
filepath <- input$file$datapath
switch(extension,
csv = read.csv(filepath),
xls = readxl::read_xls(filepath),
xlsx = readxl::read_xlsx(filepath)
)
})
#get data from data browser
data_input <- reactive({
data()
})
# info of the file
# output$about_file<-renderTable({
# summary(input$file) #input$file1
# })
output$about_file <- renderPrint({str(data())})
# to display data
output$display <- renderDataTable({
dataset = data()},
filter = 'top',escape = FALSE, options = list(pageLength = 10,
scrollX='500px',autoWidth = TRUE))
# passing to UI finally
output$data_browsing<-renderUI({
if(is.null(data())){
}else if(length(data())==1){
#h4(br(),br(),"Mismatch in formats of file selected and uploaded!",style = "font-style: italic;font-weight: bold;color: red;text-align: center;")
h4(br(),br(),"Mismatch in formats of file selected and uploaded!",style = "color:red")
}else{
tabsetPanel(tabPanel("Data Browse",dataTableOutput("display")),
tabPanel("Data Summary", verbatimTextOutput("about_file")))
}})
# End of Loading data
############################################################
################# End of datasets part ####################
############################################################
############################################################
##############输入和输出数据集#########################
############################################################
#加载数据
数据
############################################################
############## Datasets in and out #########################
############################################################
# loading data
data <- eventReactive(input$file, {
extension <- tools::file_ext(input$file$name)
filepath <- input$file$datapath
switch(extension,
csv = read.csv(filepath),
xls = readxl::read_xls(filepath),
xlsx = readxl::read_xlsx(filepath)
)
})
#get data from data browser
data_input <- reactive({
data()
})
# info of the file
# output$about_file<-renderTable({
# summary(input$file) #input$file1
# })
output$about_file <- renderPrint({str(data())})
# to display data
output$display <- renderDataTable({
dataset = data()},
filter = 'top',escape = FALSE, options = list(pageLength = 10,
scrollX='500px',autoWidth = TRUE))
# passing to UI finally
output$data_browsing<-renderUI({
if(is.null(data())){
}else if(length(data())==1){
#h4(br(),br(),"Mismatch in formats of file selected and uploaded!",style = "font-style: italic;font-weight: bold;color: red;text-align: center;")
h4(br(),br(),"Mismatch in formats of file selected and uploaded!",style = "color:red")
}else{
tabsetPanel(tabPanel("Data Browse",dataTableOutput("display")),
tabPanel("Data Summary", verbatimTextOutput("about_file")))
}})
# End of Loading data
############################################################
################# End of datasets part ####################
############################################################