R - Shiny中的xlim值无效

时间:2017-11-03 14:21:16

标签: r shiny

我想创建一个应用程序,其中包含用户想要绘制数据集的菜单,然后是另一个菜单,用于绘制他们想要绘制的变量(针对日期列)。但是我在plot.window(...)中得到错误:无效' xlim'值。 我的代码目前看起来像这样,我的问题出现在最后几行(可能是outVar)。 如果有人能指出我正确的方向那将是伟大的!

library(shiny)
library(tidyverse)
library(ggplot2)

datafile1<- read_excel("C:/Users/Piotr/Desktop/so.xlsx")
datafile2<- read_excel("C:/Users/Piotr/Desktop/gk.xlsx")


datafiles <- list(datafile1, datafile2)

ui <- fluidPage(
  selectInput('dataset', 'Choose Dataset', choices = c("goalkeeper" = "1", "defender" = "2")),
  selectInput('column', 'Choose column', choices = c("8" = "8", "9" = "9")),
  plotOutput('graph')
)

server = function(input, output, session){

  outVar <- reactive({
    temp <- datafiles[[as.numeric(input$dataset)]]
    temp <- temp[,c(1, as.numeric(input$column))]
  })

  output$graph <- renderPlot({
    plot(outVar())
  })
}


shinyApp(ui=ui, server=server) 



My structure dates:
Classes ‘tbl_df’, ‘tbl’ and 'data.frame':   500 obs. of  73 variables:
 $ Player                 : chr  "L. Bonucci" "Piqué" "Sergio Ramos" "M. Hummels" ...
 $ Team                   : chr  "Milan" "Barcelona" "Real Madrid" "Bayern München" ...
 $ Position               : chr  "RCB, CB, LCB" "RCB" "LCB" "LCB" ...
 $ Age                    : num  30 30 31 28 25 31 29 24 23 23 ...
 $ Market value           : num  4.0e+07 4.0e+07 4.0e+07 4.0e+07 3.8e+07 3.8e+07 3.8e+07 3.5e+07 3.5e+07 3.5e+07 ...
 $ Matches played         : num  49 43 46 46 52 55 23 41 51 46 ...
 $ Minutes played         : num  4307 3892 4294 3773 4402 ...
 $ Goals total            : num  5 3 9 2 5 3 0 4 4 2 ...
 $ Assists                : num  1 0 2 2 7 2 1 2 0 0 ...

0 个答案:

没有答案