29/09, 2020
$$ \begin{aligned} \dot{x} & = \sigma(y-x) \\ \end{aligned} $$
\[ \begin{aligned} \dot{x} & = \sigma(y-x) \\ \end{aligned} \]
library(shiny) library(ggplot2) data("mtcars") shinyServer(function(input, output) { output$distPlot <- renderPlot({ ggplot(mtcars, aes(x = mpg, y = wt)) + geom_point() }) })
shinyServer(function(input, output) { output$distPlot <- renderPlot({ ggplot(mtcars, aes(x = mpg, y = wt)) + geom_point() }) output$Table <- renderTable({ mtcars }) })
library(shiny) shinyUI(fluidPage( titlePanel("Old Faithful Geyser Data"), sidebarLayout( sidebarPanel( sliderInput("bins", "Number of bins:", min = 1, max = 50, value = 30) ), mainPanel( plotOutput("distPlot") ) ) ))
library(shiny) shinyUI(fluidPage( titlePanel("Datos de motor trends de 1974"), sidebarLayout( sidebarPanel( sliderInput("bins", "Number of bins:", min = 1, max = 50, value = 30) ), mainPanel( plotOutput("distPlot"), tableOutput("Table") ) ) ))
library(shiny) shinyUI(fluidPage( titlePanel("Datos de motor trends de 1974"), sidebarLayout( sidebarPanel( selectInput("Variable", "Selecciona la Variable y:", choices = c("cyl", "disp", "hp", "drat", "wt", "qsec", "vs", "am", "gear", "carb"), selected = "wt") ), mainPanel( plotOutput("distPlot"), tableOutput("Table") ) ) ))
shinyServer(function(input, output) { output$distPlot <- renderPlot({ ggplot(mtcars, aes_string(x = input$Variable, y = "mpg")) + geom_point() }) output$Table <- renderTable({ mtcars }) })
mainPanel(plotOutput("distPlot"), selectInput("Modelo", "Selecciona el tipo de modelo:", choices = c("lm", "loess", "gam"), selected = "lm"))
output$distPlot <- renderPlot({ ggplot(mtcars, aes_string(x = input$Variable, y = "mpg")) + geom_smooth(method = input$Modelo) + geom_point() })
sidebarPanel(selectInput("Variable", "Selecciona la Variable x:", choices = c("cyl", "disp", "hp", "drat", "wt", "qsec", "vs", "am", "gear", "carb"), selected = "wt"), sliderInput("YLIM", "Selecciona los límites del eje y:", min = 0, max = 40, step = 2, value = c(0, 20)))
output$distPlot <- renderPlot({ p <- ggplot(mtcars, aes_string(x = input$Variable, y = "mpg")) + geom_smooth(method = input$Modelo) + geom_point() p + ylim(input$YLIM) })
mainPanel(plotOutput("distPlot"), textInput("Formula", "Escribe la formula de tu modelo:", value = "y ~ x + I(x^2)"))
output$distPlot <- renderPlot({ p <- ggplot(mtcars, aes_string(x = input$Variable, y = "mpg")) + stat_smooth(method = "lm", formula = input$Formula) + geom_point() p + ylim(input$YLIM) })
mainPanel(plotOutput("distPlot"), textInput("Formula", "Escribe la formula de tu modelo:", value = "y ~ x + I(x^2)"), submitButton("Actualizar modelo", icon("refresh")))
sliderInput("YLIM", "Selecciona los límites del eje y:", min = 0, max = 40, step = 2, value = c(0,20) ), checkboxGroupInput("Factores", "Transformar en factores:", c("cyl", "disp", "hp", "drat", "wt", "qsec", "vs", "am", "gear", "carb"), selected = "am")
output$distPlot <- renderPlot({ mt <- as.data.frame(map_at(mtcars, factor, .at = input$Factores)) p <- ggplot(mt, aes_string(x = input$Variable, y = "mpg")) + stat_smooth(method = "lm", formula = input$Formula) + geom_point() p + ylim(input$YLIM) })
output$distPlot <- renderPlot({ mt <- as.data.frame(map_at(mtcars, factor, .at = input$Factores)) p <- ggplot(mt, aes_string(x = input$Variable, y = "mpg")) if (class(mt[, input$Variable]) == "numeric") { p <- p + stat_smooth(method = "lm", formula = input$Formula) + geom_point() } if (class(mt[, input$Variable]) == "factor") { p <- p + geom_boxplot() } p + ylim(input$YLIM) })
checkboxGroupInput("Factores", "Transformar en factores:", c("cyl", "disp", "hp", "drat", "wt", "qsec", "vs", "am", "gear", "carb"), selected = "am"), selectInput("Color", "Color segun la variable:", choices = c("cyl", "disp", "hp", "drat", "wt", "qsec", "vs", "am", "gear", "carb"))
output$distPlot <- renderPlot({ mt <- as.data.frame(map_at(mtcars, factor, .at = input$Factores)) p <- ggplot(mt, aes_string(x = input$Variable, y = "mpg")) if (class(mt[, input$Variable]) == "numeric") { p <- p + stat_smooth(method = "lm", formula = input$Formula, aes_string(fill = input$Color)) + geom_point() } if (class(mt[, input$Variable]) == "factor") { p <- p + geom_boxplot(aes_string(fill = input$Color)) } p + ylim(input$YLIM) })
Evaluación final (Viernes 14 de Septiembre)