1
|
library(shiny)
# Define UI for application that draws a histogram
shinyUI(fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
numericInput("pocet", "vyber pocet R v tab", 10, min = 1, max = 100),
wellPanel(
selectInput("atribut","Vyberte atribut",choices =colnames(airquality)),
radioButtons("farba","Vyberte farbu grafu",choices=c("yellow","red","green")),
textInput("nadpis", "zadajte nadpis ", "nadpis"),
actionButton("goButton", "Go!")
)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot"),
tableOutput("table")
)
)
))
Server :
library(shiny)
# Define server logic required to draw a histogram
shinyServer(function(input, output) {
observeEvent(input$goButton, {
output$distPlot <- renderPlot({
boxplot(get(input$atribut)~Month, data = airquality, col = input$farba, main = input$nadpis)
})
output$table <- renderTable({
tail(airquality, input$pocet)
})
}, once=TRUE)
})
|
|
|
2
|
Skupina A :
ibrary(shiny)
# Define UI for application that draws a histogram
shinyUI(fluidPage(
# Application title
titlePanel("Data o mestach "),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
selectInput("atribut", "Vyberte atribut:",
choices = c(colnames(state.x77))),
radioButtons("farba", "vyber farbu:",
choices =c(red= "red" , blue= "blue" )),
numericInput("cislo", "vyber:", 12, min = 2, max = 20),
numericInput("rozdelenie", "vyber:", 12, min = 1, max = 50)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot"),
tableOutput("tables")
)
)
))
Server:
library(shiny)
# Define server logic required to draw a histogram
shinyServer(function(input, output) {
output$distPlot <- renderPlot({
x <- state.x77[,input$atribut]
bins <- seq(min(x), max(x), length.out = input$cislo +1)
hist(x, breaks = bins, col= input$farba)
})
output$tables <- renderTable({ head(iris, input$cislo)
})
})
|
|
|
3
|
C
server
library(shiny)
# Define server logic required to draw a histogram
shinyServer(function(input, output) {
output$textik <- renderText({
vypis=c("Vybrali ste si", input$radioID, "farbu a na porovnanie ste zadali atribúty ", input$selectID1, input$selectID2)
print(vypis)
})
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
# neviem ako zobrazit zaroven aj iny stlpec od selectID2
x <- quakes[, input$selectID1]
#bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, col =input$radioID, border = 'white', lwd=input$numericID)
})
})
library(shiny)
# Define UI for application that draws a histogram
shinyUI(fluidPage(
# Application title
titlePanel("Dáta Quakes"),
flowLayout(
selectInput("selectID1","Vyberte atribút č.1",choices=colnames(quakes)),
selectInput("selectID2","Vyberte atribút č.2", choices=colnames(quakes)),
radioButtons("radioID","Vyberte farbu grafu",choices=c("green","yellow","black")),
numericInput("numericID","Zadajte hrúbku bodov:",value=1, min=1, max=3)
),
# Show a plot of the generated distribution
mainPanel(
textOutput("textik"),
plotOutput("distPlot"),
tableOutput("tablee")
)
)
)
|
|
|
4
|
f=function(x){
5*sin(x)-exp(x)
}
curve(5*sin(x),-5,5)
curve(exp(x),add=TRUE, col="blue")
# vsetky sa nedaju najst.........
uniroot(f, lower=-4, upper=-2, tol=1e-4)
uniroot(f, lower=0, upper=1, tol=1e-4)
uniroot(f, lower=1, upper=2, tol=1e-4) # najvyssi koren
predaj=c(9,5,18,14,10,12,7,11,5,16,14,11)
cena=c(18,24,9,15,17,16,20,15,22,14,15,19)
tabulka=data.frame(predaj,cena)
ciara=lm(predaj~cena,data=tabulka)
plot(tabulka)
abline(ciara)
|
|
|
5
|
---
title: "Skupina A"
author: "Tomáš"
date: "22 apríla 2017"
output: html_document
---
#Štruktúra systému R
**R** systém je rozdelený do *dvoch* konceptuálnych častí.
<!-- nemam ten zoznam -->
********
##Relevantné simulačné nástroje
Názov | Výhody | Nevýhody | Open-source
------|--------|----------|------------
R |Podpora knižníc|Náročnejší|Áno
Matlab|Podpora matíc|Podpora štat. metód|Nie
###Dáta mtcars
Dáta mtcars obsahujú tieto názvy stĺpcov
```{r, echo=TRUE}
tab=mtcars
print(colnames(tab))
```
<!--Neviem dat dokopy histogramy-->
```{r pressure, echo=FALSE}
hist(tab$hp, col="blue", main="Nadpis grafu", xlab="hp")
hist(tab$wt, col="blue", main="Nadpis grafu", xlab ="wt")
---
title: "Skupina C"
author: "Tomáš"
date: "24 apríla 2017"
output: html_document
---
## Štruktúra systému R
**R** systém je rozdelný do *dvoch* konceptuálnych častí.
1. R "base" systém
+ CRAN(priestor pre zdielanie balíkov)
2. Všetko ostatné
### Kvadratická rovnica
Diskriminant vypočítame podľa vzorca $D=b^2{2}+4*a*c$
##Dáta a graf
Počet stĺpcov a riadkov dát airquality
```{r eval=FALSE }
nrow(airquality)
ncol(airquality)
```
```{r echo=FALSE }
boxplot(airquality$Ozone~airquality$Month, col="blue", xlab="xova os", ylab="ylonova os", main="GRAF")
```
|
|
|
|