-
Notifications
You must be signed in to change notification settings - Fork 0
/
ess_gui.Rmd
105 lines (73 loc) · 2.78 KB
/
ess_gui.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
---
title: "Eurostat"
output:
html_document:
theme: spacelab
runtime: shiny
---
</br>
## Tutki
"Aloitin kirjoittamaan ESS-datan dynaamita käyttöliittymää"
```{r, echo=FALSE, eval=TRUE, fig.height=12, eval=TRUE}
source("data_arvot.R")
source("funktiot.R")
shinyApp(
ui = fluidPage(
#sidebarLayout(
inputPanel(
selectInput("var", h4("Variaabeli"),
choices = list("imsmetn" = "df$imsmetn",
"imdfetn" = "df$imdfetn",
"impcntr" = "df$impcntr",
"imbgeco" = "df$imbgeco",
"imueclt" = "df$imueclt",
"imwbcnt" = "df$imwbcnt",
"freehms" = "df$freehms")),
uiOutput("ui"),
submitButton("Päivitä!", icon("refresh"))
),
tabsetPanel(
tabPanel("Raakadatan eka rivit", verbatimTextOutput("raaka")),
# tabPanel("Aikasarjadata", tableOutput("taulukko")),
tabPanel("histogrammi", plotOutput("hist", width="100%", height="800"))#,
# tabPanel("Kartan data", tableOutput("kartta_data")),
# tabPanel("Kartta", plotOutput("kartta", width="100%", height="800"))
)
#)
),
server = function(input, output) {
dataInput <- reactive({
load("data/ess_arvot.rda")
df <- ess_arvot
df
})
output$ui <- renderUI({
df <- dataInput()
# levels
bar <- function(x) as.character(eval(parse(text=x)) )
variable <- as.factor(bar(input$var))
levelit <- levels(variable)
checkboxGroupInput("col1", h5("Subset"),
choices = levelit)
})
output$raaka <- renderPrint({
df <- dataInput()
bar <- function(x) as.character(eval(parse(text=x)) )
variable <- bar(input$var)
#variable[c(input$col1)]
head(variable[!(variable %in% input$col1)], 20)
#as.data.frame(variable)
})
output$hist <- renderPlot({
df <- dataInput()
bar <- function(x) as.character(eval(parse(text=x)) )
variable <- bar(input$var)
#variable[c(input$col1)]
var <- variable[!(variable %in% input$col1)]
library(ggplot2)
qplot(var)
})
},
options = list(height = 1500))
```
col1 <- "Allow a few"