Hello,
I get always this error when i want to evaluate a linear model.
my steps
1 downloaded dataset on kaggle
2 created my model and saved it as .rds file
3 saved this file in folder of my shiny app
4 wrote this code for my shiny app
library(shiny)
library(nnet)
library(caret)
#create dataframe newdata for storing predictors, choosen by the slider input
newdata<-data.frame(c("adver_TV"))
ui <- fluidPage(
# App title ----
titlePanel("Marketing"),
sidebarLayout(
# Sidebar panel for inputs ----
sidebarPanel(
# Input: Slider for the number of bins ----
sliderInput(
inputId = "bins",
label = "total budget advertentions:",
min = 1,
max = 500,
value = 30
)
),
mainPanel(
# Output: result ----
verbatimTextOutput("Sales")
)
)
)
# Define server logic required to draw a histogram ----
server <- function(input, output) {
#model
model<-readRDS('Simplemodel.RDS')
newdata[1]<- reactive({input$bins})
output$Sales <- renderText(predict(model,({newdata})))
}
# Create Shiny app ----
shinyApp(ui = ui, server = server)
What did i do wrong? can someone help me?
Kind regards and thx for your time,
Nobel