Tom K. answered 12/07/20
Knowledgeable and Friendly Math and Statistics Tutor
sd should be part of the same summarize function as the mean.
Jazmine T.
asked 12/07/20Error message:
Error: unexpected '=' in:
" summarise(`Support For H-1B Visas` = mean(h1bvis.supp, na.rm = TRUE) %>%
sd ="
Code:
immig %>%
mutate(`Full Sample` = case_when(
tech.whitcol==1~ "Tech Workers",
nontech.whitcol==1~ "Other White Collar Workers",
nontech.whitcol==0 & employed==1~ "Non-Tech/Non-White Collar Workers",
employed==0~ "Not Employed" )) %>%
group_by(`Full Sample`) %>%
summarise(`Support For H-1B Visas` = mean(h1bvis.supp, na.rm = TRUE) %>%
sd = sd(`Full Sample`[[col]], na.rm=TRUE)) %>%
ggplot(aes(`Full Sample`,`Support For H-1B Visas`)) +
geom_bar(stat="identity") +
geom_errorbar(aes(ymin=`Support for H-1B Visas` - sd, ymax=`Support for H-1B Visas` - sd), width=.2) +
ggtitle("(a) Economic threat reduces support for H-1B visas")
Tom K. answered 12/07/20
Knowledgeable and Friendly Math and Statistics Tutor
sd should be part of the same summarize function as the mean.
Muhammad R. answered 02/08/21
ISU Grad For Statistics, R and ArcGIS Tutoring
Rewrite the following chunk as:
summarise(`Support For H-1B Visas` = mean(h1bvis.supp, na.rm = TRUE),
sd = sd(`Full Sample`[[col]], na.rm=TRUE)) %>%
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.