TigerZheng commited on
Commit
ffb3634
·
verified ·
1 Parent(s): 37440a7

Delete test.qmd

Browse files
Files changed (1) hide show
  1. test.qmd +0 -83
test.qmd DELETED
@@ -1,83 +0,0 @@
1
- ---
2
- title: "Diamonds Explorer"
3
- author: "Barkamian Analytics"
4
- format: dashboard
5
- server: shiny
6
- ---
7
-
8
- ```{r}
9
- #| context: setup
10
- library(ggplot2)
11
- dataset <- diamonds
12
- ```
13
-
14
- # {.sidebar}
15
-
16
- ```{r}
17
- sliderInput('sampleSize', 'Sample Size',
18
- min=1, max=nrow(dataset),
19
- value=min(1000, nrow(dataset)),
20
- step=500, round=0)
21
- br()
22
- checkboxInput('jitter', 'Jitter')
23
- checkboxInput('smooth', 'Smooth')
24
- ```
25
-
26
- ```{r}
27
- selectInput('x', 'X', names(dataset))
28
- selectInput('y', 'Y', names(dataset), names(dataset)[[2]])
29
- selectInput('color', 'Color', c('None', names(dataset)))
30
- ```
31
-
32
- ```{r}
33
- selectInput('facet_row', 'Facet Row',
34
- c(None='.', names(diamonds[sapply(diamonds, is.factor)])))
35
- selectInput('facet_col', 'Facet Column',
36
- c(None='.', names(diamonds[sapply(diamonds, is.factor)])))
37
- ```
38
-
39
- # Plot
40
-
41
- ```{r}
42
- plotOutput('plot')
43
- ```
44
-
45
- # Data
46
-
47
- ```{r}
48
- tableOutput('data')
49
- ```
50
-
51
- ```{r}
52
- #| context: server
53
-
54
- dataset <- reactive({
55
- diamonds[sample(nrow(diamonds), input$sampleSize),]
56
- })
57
-
58
- output$plot <- renderPlot({
59
-
60
- p <- ggplot(
61
- dataset(),
62
- aes_string(x=input$x, y=input$y)) + geom_point()
63
-
64
- if (input$color != 'None')
65
- p <- p + aes_string(color=input$color)
66
-
67
- facets <- paste(input$facet_row, '~', input$facet_col)
68
- if (facets != '. ~ .')
69
- p <- p + facet_grid(facets)
70
-
71
- if (input$jitter)
72
- p <- p + geom_jitter()
73
- if (input$smooth)
74
- p <- p + geom_smooth()
75
-
76
- p
77
-
78
- })
79
-
80
- output$data <- renderTable({
81
- dataset()
82
- })
83
- ```