require(shiny)
setwd("C://Users//Harshad//Desktop//Equiskill - BA")
cars <- read.table(file = "cars.csv", sep = ",", header = TRUE, quote="")
var_list <- as.character(names(cars))
ui <- fluidPage
(
selectInput(inputId = "var",label = "Select Dependent Variable:",choices = c(var_list))
)
server <- function(input,output)
{
}
shinyApp(ui <- ui, server <- server)
I am getting error "ERROR: cannot coerce type 'environment' to vector of type 'character'" while executing above shiny app code in R studio. Please help me resolve the issue.
You should avoid putting newlines and even spaces after the function names. Refer to style guide or here. Code below works perfectly fine.
require(shiny)
# load your data I am using default mtcars data here
cars <- mtcars
var_list <- as.character(names(cars))
ui <- fluidPage(
selectInput(inputId = "var",label = "Select Dependent Variable:", choices = c(var_list))
)
server <- function(input,output)
{
}
shinyApp(ui = ui, server = server)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With