Hello, I’m getting an “object not found” error when trying to plot a cleaned dataset using ggplot()
. I created the object as surv_clean
, but the error says Surv_clean
is not found. Kindly help me in resolving this issue.
Here is my R code:
# reprex 1
# 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()
Thanks in advance for your kind assistance!