I am getting an object not found and cannot find the capital S. Please help. Code is below
# install and load packages
pacman::p_load(rio, here, janitor, tidyverse, reprex, datapasta)
# import data
surv_raw <- data.frame(
stringsAsFactors = FALSE,
adm3_name_res = c(NA,"Mountain Rural",
"Mountain Rural","East II","West III"),
sex = c("m", "f", "f", "f", "f")
)
# clean the surveillance data
surv_clean <- surv_raw %>%
clean_names()
# make a horizontal bar plot of cases per district, filled by sex
ggplot(
data = Surv_clean,
mapping = aes(y = adm3_name_res, fill = sex))+
geom_bar()
#> Error in eval(expr, envir, enclos): object 'Surv_clean' not found
Created on 2024-07-18 with reprex v2.1.0
Session info
sessionInfo()
#> R version 4.3.1 (2023-06-16)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Red Hat
#>
#> Matrix products: default
#> BLAS/LAPACK: /usr/lib64/libopenblasp-r0.3.3.so; LAPACK version 3.8.0
#>
#> locale:
#> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
#> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
#> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
#> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
#> [9] LC_ADDRESS=C LC_TELEPHONE=C
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
#>
#> time zone: Australia/Sydney
#> tzcode source: system (glibc)
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] datapasta_3.1.0 reprex_2.1.0 lubridate_1.9.3 forcats_1.0.0
#> [5] stringr_1.5.0 dplyr_1.1.4 purrr_1.0.2 readr_2.1.5
#> [9] tidyr_1.3.1 tibble_3.2.1 ggplot2_3.5.1 tidyverse_2.0.0
#> [13] janitor_2.2.0 here_1.0.1 rio_1.1.1
#>
#> loaded via a namespace (and not attached):
#> [1] styler_1.10.3 utf8_1.2.4 generics_0.1.3 stringi_1.7.12
#> [5] hms_1.1.3 digest_0.6.36 magrittr_2.0.3 evaluate_0.24.0
#> [9] grid_4.3.1 timechange_0.3.0 fastmap_1.2.0 R.oo_1.26.0
#> [13] R.cache_0.16.0 rprojroot_2.0.4 R.utils_2.12.3 fansi_1.0.6
#> [17] scales_1.3.0 cli_3.6.1 rlang_1.1.1 R.methodsS3_1.8.2
#> [21] munsell_0.5.1 withr_3.0.0 yaml_2.3.8 tools_4.3.1
#> [25] tzdb_0.4.0 colorspace_2.1-0 pacman_0.5.1 vctrs_0.6.5
#> [29] R6_2.5.1 lifecycle_1.0.3 snakecase_0.11.1 fs_1.6.4
#> [33] pkgconfig_2.0.3 pillar_1.9.0 gtable_0.3.5 glue_1.6.2
#> [37] xfun_0.45 tidyselect_1.2.1 rstudioapi_0.16.0 knitr_1.47
#> [41] htmltools_0.5.8.1 rmarkdown_2.27 compiler_4.3.1