1

我在 RShiny 中遇到问题。下面我显示来自 2 个文件的代码:

# File app.R
library(shiny)
library(dplyr)
source("myscript.R")
library(rhandsontable)
shinyUI<-fluidPage(
fluidRow(
    titlePanel(title = "Application in RSHINY"),
    textInput("text1", "Give numbers with commas","1,3,12,18"),
    submitButton("Update!"),
    column(8,actionButton("saveBtn","Save"),rHandsontableOutput("table"))))

shinyServer<-function(input,output,session){  
    output$table <- renderRHandsontable({
    arg=(strsplit(input$text1,",") %>% unlist() %>% as.numeric())
    tabelaa=dataframe_FUNCTION(arg)
    rownames(tabelaa)=paste("Row",1:4,sep="")
    rhandsontable(format(tabelaa, digits=0),width=400,rowHeaderWidth=300)
})
}
shinyApp(ui=shinyUI, server=shinyServer)

问题 1)当我更改 rhandsontable 中的值并单击按钮更新时,我想自动更改 rhandsontable 值。问题 2) 如何将当前的 rhandsonetable 写入 csv 文件

## myscript.R
dataframe_FUNCTION<-function(...){
aa=list(...)
my_df=data.frame(aa)
colnames(my_df)="COL"
return(my_df^2)
}
4

0 回答 0