I am using shiny to create a simple app.
ui.R
library(shiny)
shinyUI(fluidPage(
titlePanel("Power Breakdown!"),
sidebarLayout(
sidebarPanel()
mainPanel(
plotOutput("plt"))
)
) )
and server.R is (needed dataset is at loc)
library(shiny)
library(ggplot2)
df <- readRDS("dataframe-path")
shinyServer(
function(input, output) {
output$plt <- renderPlot({
df$timestamp <- as.Date(df$timestamp)
p <- ggplot(df,aes(df$timestamp,df$power))+theme_bw() +geom_point()
print(p)
})
})
When I run this application, following error is generated
Error in df$timestamp : object of type 'closure' is not subsettable
Whenever I run the same server script as a normal R script everything works properly, but while using same code snippet in shiny results in above error.
Note: I referred the same question at links 1 , 2, 3 , but without any success