0
Ich lerne Shiny und versuche, die quantitativen Daten aus dem Iris-Datensatz zu plotten. Mein Selectineinput in der ui.R scheint zu funktionieren, aber ich kann es nicht zum Plotten bekommen. Irgendein Rat? -Code untenErstellen einer Zeichnung mit Shiny in R
ui.R
irisx<-read.csv("iris.csv",header=T)
library(shiny)
shinyUI(fluidPage(
titlePanel("Assignment 11"),
sidebarLayout(
sidebarPanel(
selectizeInput("x","X:",choices = c("Sepal Length"="Sepal.Length","Sepal Width"="Sepal.Width","Petal Length"="Petal.Length", "Petal Width"="Petal.Width")),
selectizeInput("y","Y:",choices = c("Sepal Length"="Sepal.Length","Sepal Width"="Sepal.Width","Petal Length"="Petal.Length", "Petal Width"="Petal.Width"))
),
mainPanel(plotOutput("irisChart"))
)
))
server.R
irisx<-read.csv("iris.csv",header=T)
library(shiny)
library(ggplot)
shinyServer(function(input,output){
output$irisChart<-renderPlot({
irx<-as.numeric(input$x)
iry<-as.numeric(input$y)
p1<-ggplot(irisx,aes(input$x,input$y)) + geom_point()
print(p1)
})
})
Danke Schweinekotelett! – David