An excerpt from the app, followed by the stack dump
# Load packages
library(shiny)
#library(shinyjs)
library(bslib)
library(ggplot2)
library(magrittr)
library(lubridate)
library(foreign)
library(dplyr)
library(DT)
library(bsicons)
library(haven)
library(ggplot2)
library(plotly)
ui = fluidPage(
tabsetPanel(
############################ Tab 1 Layout ########################
tabPanel("Respondents Profile", fluid = TRUE,
sidebarLayout(sidebarPanel("Control Panel",
helpText("Results of survey from 01/01/2019 to 04/17/2024"),
tags$style(type='text/css', ".selectize-input { font-size: 10px; line-height: 10px;} .selectize-dropdown { font-size: 10px; line-height: 10px; }"),
position = "right",
radioButtons ("loc", "What community do you want to view?",
choices = c("Place A" = 1122000,
"Place B" = 1130001
),
selected = "Place A"),
style="font-size:11px"),
mainPanel(
#Sample
#Age at Survey
# card(
# height ="400px",
#
# splitLayout(cellWidths = c("50%", "50%"), plotOutput("Survey_Version", width = "100%", height = "100%"), plotOutput("Age", width = "100%", height = "100%"))
# ),
#
# textOutput("location"),
textOutput("samplesize")
))
)
)
)
# Define server logic ----
server <- function(input, output) {
comm <- read_sav("C:/Users/ACollier/Documents/R_Projects/IRResources/reduced.sav")
community1 <- reactive({
as.data.frame(subset(comm, hrdcoffice == input$loc))
})
############################Server stuff for Tab 1 ########################
#Survey Verison
# output$Survey_Version <- renderPlot({
# sversion <- ggplot(data = community1(), aes(survey_version)) + geom_text(stat="count", aes(label = ..count..),vjust = -0.7) + geom_histogram(binwidth = 0.5, fill = "#757575", color = "#1A381B")
# sversion <- sversion + scale_x_continuous(breaks=c(1, 2, 3),labels = c("Version 1", "Version 2", "Version 3")) + labs(x = "Survey Version") + labs(title = "Survey Version", subtitle = "Frequency")
# sversion <- sversion + labs(caption = "(From March 31, 2024 Data Survey)")
#
# sversion
# }, height = 400, width = 400)
#
#
# #Age Output
# output$Age <- renderPlot({
# age <- ggplot(data = community1(), aes(factor(r_Age_at_survey))) + geom_bar(width = 0.1) + geom_text(stat="count", aes(label = ..count..),vjust = -.7) + geom_histogram(stat="count",fill = "#99846D",color = "#1A381B")
# age <- age + labs(x = "Age at Survey") + labs(title = "Age at Survey", subtitle = "Frequency")
# age <- age + scale_x_discrete(breaks = c(19, 29, 44, 54, 64, 65),labels = c("Under 20", "20 to 29", "30 to 44", "45 to 54", "55 to 64", "65 Plus"),guide=guide_axis(angle = 45)) + labs(caption = "(From March 31, 2024 Data Survey)")
#
# age
# }, height = 450, width = 450)
#
# Recall the value of community1 using community1(), e.g.
output$samplesize <- renderText(nrow(community1()))
}
# Run the app ----
shinyApp(ui = ui, server = server)
Warning: Error in : x
and y
must have same types and lengths.
122: vec_equal
121: ==.vctrs_vctr
120: eval
119: eval
118: subset.data.frame
115: reactive:community1 [C:\Users\ACollier\Documents\App-1/app.R#71]
99: community1
97: renderText
96: func
83: renderFunc
82: output$samplesize
1: runApp
Warning: Error in vec_equal: Can't combine ..1
and ..2
.
142:
141: signalCondition
140: signal_abort
139: abort
138: stop_vctrs
137: stop_incompatible
136: stop_incompatible_type
132: vec_default_ptype2
131:
130: vec_ptype2
129: vec_ptype2.character.haven_labelled
128:
127: vec_ptype2
126: vec_ptype2.haven_labelled.character
125:
124: vec_cast_common_opts
123: vec_cast_common_params
122: vec_equal
121: ==.vctrs_vctr
120: eval
119: eval
118: subset.data.frame
115: reactive:community1 [C:\Users\ACollier\Documents\App-1/app.R#71]
99: community1
97: renderText
96: func
83: renderFunc
82: output$samplesize
1: runApp
Warning: Error in vec_equal: Can't combine ..1
and ..2
.
142:
141: signalCondition
140: signal_abort
139: abort
138: stop_vctrs
137: stop_incompatible
136: stop_incompatible_type
132: vec_default_ptype2
131:
130: vec_ptype2
129: vec_ptype2.character.haven_labelled
128:
127: vec_ptype2
126: vec_ptype2.haven_labelled.character
125:
124: vec_cast_common_opts
123: vec_cast_common_params
122: vec_equal
121: ==.vctrs_vctr
120: eval
119: eval
118: subset.data.frame
115: reactive:community1 [C:\Users\ACollier\Documents\App-1/app.R#71]
99: community1
97: renderText
96: func
83: renderFunc
82: output$samplesize
1: runApp
Warning: Error in vec_equal: Can't combine ..1
and ..2
.
142:
141: signalCondition
140: signal_abort
139: abort
138: stop_vctrs
137: stop_incompatible
136: stop_incompatible_type
132: vec_default_ptype2
131:
130: vec_ptype2
129: vec_ptype2.character.haven_labelled
128:
127: vec_ptype2
126: vec_ptype2.haven_labelled.character
125:
124: vec_cast_common_opts
123: vec_cast_common_params
122: vec_equal
121: ==.vctrs_vctr
120: eval
119: eval
118: subset.data.frame
115: reactive:community1 [C:\Users\ACollier\Documents\App-1/app.R#71]
99: community1
97: renderText
96: func
83: renderFunc
82: output$samplesize
1: runApp