Hello again:
I have the following shiny code in which the selections are currently in a word description:
ui <- fluidPage(
selectInput("shape1","Shapes",choices=c("Plus","Star","Diamond")),
plotOutput("plot1")
)
server <- function(input,output,session) {
output$plot1 <- renderPlot({
df <- data.frame(x=c(1, 3, 3, 4, 5, 5, 6, 9, 12, 15),
y=c(13, 14, 14, 12, 17, 21, 22, 28, 30, 31),xsp=rep(NA,10))
if(input$shape1=="Plus") {
df$xsp <- rep(3,10)
p <- ggplot(df, aes(x=x, y=y)) +
geom_point(aes(x,y),shape=df$xsp)
}
if(input$shape1=="Star") {
df$xsp <- rep(4,10)
p <- ggplot(df, aes(x=x, y=y)) +
geom_point(aes(x,y),shape=df$xsp)
}
if(input$shape1=="Diamond") {
df$xsp <- rep(5,10)
p <- ggplot(df, aes(x=x, y=y)) +
geom_point(aes(x,y),shape=df$xsp)
}
p
})
}
shinyApp(ui,server)
I would like the actual symbol to appear, say shape(3) from ggplot or pch=3, in base R. Is that possible, please?
Thanks,
Erin