Tuesday, 15 July 2014

R, Shiny, plotting a reactive data frame (data goes "missing") -



R, Shiny, plotting a reactive data frame (data goes "missing") -

given next ui.r , server.r , circuit.csv; can produce simple plot reacts user input (power in case).

however, not values powerfulness returned. example, .5 produces plot whereas .6 not, on , forth @ random occurrence throughout powerfulness range.

if plot table instead, check work, same thing, powerfulness inputs work expected , others produce no table, , no plot when asking plot.

ui.r

library(shiny) library(ggplot2) shinyui(fluidpage( hr(), sidebarlayout( sidebarpanel( sliderinput("power",label = "power", min = 0, max = 5, value = .5, step = .1) ), mainpanel( p("lum vs distance power"), plotoutput('plot1') ) ) ))

server.r

library(shiny) library(ggplot2) df <- read.table(file = "circuit.csv", sep=",", header = true) shinyserver(function(input, output) { output$plot1 <- renderplot({ df2 <- subset(df,df$pow==input$power) p <- ggplot(df2)+ geom_point(aes(x=dist, y=lum)) print(p) }) })

link github (for csv data)

i post images not allowed @ time.

r shiny

No comments:

Post a Comment