私は光沢のある新しいです。光沢のある光沢のあるダボードを使用してアプリを作成しようとしています。私は輝いています。CSVファイルをアップロードするために使用しているアクションボタンを作成しました。この後、このファイルに基づいてggplotを作成しています。
問題:
- R console の代わりに csv ファイルをアプリに表示したい。
- プロットの入力として操作を実行した後、最終的な csv ファイルを取得する方法が見つかりません。
私のデータセットのサンプル:
A B Class
50.00 90.00 A
50.01 91.00 A
50.05 91.05 B
51.50 91.09 C
51.09 90.20 D
ui.R
ui <- dashboardSidebar(
sidebarMenu(menuItem("choose",tabName = "choose")),
menuItem("Plot",tabName = "Plot")
body <- dashboardBody(
tabItems(
tabItem(tabName = "choose",
fluidRow(
actionButton("select", "select"),
)
tabItem(tabName = "plot",
fluidRow(
box(plotOutput("plot"))))
)
サーバー.R
select <- function(){
dataframe <- read.table(file.choose(),header = TRUE, sep = ","
,stringsAsFactors=FALSE)
attach(dataframe)
dataframe1 <- subset(dataframe, select = c(A,B))
dataframe2 <- dataframe %>% mutate(variance1 = var(A)) %>%
mutate(variance2 = var(B))
return(print(dataframe2))
}
server <- function(input,output){
observeEvent(
input$select,{
select()
}
output$plot <- renderPlot({
pd <- input$dataframe2
pd1 <- ggplot(pd, aes(y = A, x = B, colour = Class)) +geom_point() +
print(pd1)
})
shinyApp(ui,server)