I am trying to create a shiny app that would plot the data based one column name to another one based on the two columns selected. This is my code but not sure where I am going wrong? Not sure if the select column is working correclty. Thanks
data1 <- tibble::tribble(
~power_draw_watt, ~gpu_temp_c, ~gpu_util_perc,
131.55, 48L, 92L,
117.03, 40L, 92L,
121.64, 45L, 91L,
50.23, 38L, 90L,
141.82, 41L, 90L,
120.5, 43L, 88L,
121.09, 41L, 91L,
27.18, 35L, 0L,
139.63, 43L, 93L,
77.87, 36L, 90L,
88.47, 40L, 91L,
125.88, 43L, 90L,
42.44, 41L, 0L,
96.04, 39L, 90L,
94.27, 42L, 92L,
146.32, 43L, 93L,
93.58, 42L, 92L,
125.01, 51L, 88L,
71.59, 41L, 89L,
96.88, 44L, 91L,
41.38, 38L, 0L,
129.4, 41L, 86L,
102.62, 41L, 90L,
124.08, 41L, 90L,
155.11, 48L, 93L,
42.48, 34L, 0L,
141.29, 41L, 94L,
143.55, 41L, 94L,
89.96, 41L, 92L,
28.67, 39L, 0L,
39.42, 35L, 0L,
115.72, 43L, 81L,
74.24, 42L, 88L,
121.99, 42L, 92L,
89.05, 45L, 91L,
95.33, 38L, 85L,
119.93, 41L, 91L,
123.62, 37L, 94L,
42.21, 37L, 0L,
102.21, 38L, 90L,
113.52, 43L, 89L,
97.03, 46L, 94L,
137.69, 39L, 91L,
36.27, 37L, 0L,
37.23, 35L, 0L,
136.58, 48L, 93L,
103.83, 44L, 89L,
51.29, 41L, 0L,
47.64, 37L, 0L,
89.85, 47L, 89L
)
library(shiny)
ui <- fluidPage(
mainPanel(
plotOutput("plot")
),
selectInput(inputId ="data1",
label = "choose data1",
choices = names(data1),
selected = NULL
),
selectInput(inputId ="data2",
label = "choose data 2",
choices = names(data1),
selected = NULL
),
textOutput("result"))
server <- function(input,output){
output$plot <- renderPlot({
ggplot(data1,aes(x=data1$data1,y=data1$data2))+geom_point(colour='red')},height = 400,width = 600)
}
shinyApp(ui=ui,server=server)