In my application the user can upload any .csv file and plot it (I have simplified example by using an online file, and I realise the example plot is pretty useless). I am currently having trouble with plotting the stars symbol from the user input.
I want to use a selectizeInput so they can select any number of the columns to plot as the length of the rays. The stars need to take a matrix of the columns but I think selectize returns as a list.
The method I used in the code below shows what I want but it only takes so many columns. I assume there is an easy way to do this but I am quite new to R and could not find anything that worked when I searched.
ui.R
shinyUI(pageWithSidebar(
headerPanel("Scatterplot of star symbols"),
sidebarPanel(
selectizeInput("starSpokes", "Select colums for star spoke lengths", c("murder", "Forcible_rate", "Robbery", "aggravated_assult", "burglary"), multiple = TRUE)
),
mainPanel(
plotOutput("graphPlot")
)
))
server.R
shinyServer(function(input, output, session) {
crime = read.csv("http://datasets.flowingdata.com/crimeRatesByState2005.tsv", header = TRUE, sep ="\t")
output$graphPlot = renderPlot({
starRays = cbind(crime[[input$starSpokes[1]]], crime[[input$starSpokes[2]]], crime[[input$starSpokes[3]]], crime[[input$starSpokes[4]]])
symbols(x=crime$murder, y=crime$burglary, stars = starRays)
})
})
I apologise if this has already been answered, I have searched but found nothing that works, possibly because I do not know the correct terms to search for or have implemented their methods wrong.
Any help would be much appreciated, thanks