library(ggplot2)
library(tidyverse)
library(haven)
library(tidyverse)
library(dplyr)
library(ggplot2)
library(ggeasy)
library(corrplot)
library(ggpubr)
library(jmv)
library(rstatix)
library(tidyverse)
library(here)
library(car)
library(psych)
library(janitor)
library(ggeasy)
library(gt)
assignment_data <- read_sav("data_data.sav")
covid_data_investigate <- assignment_data %>%
group_by(region) %>%
select(Adhere_shop_groceries, Adhere_shop_other, Adhere_meet_friends) %>%
summarise(mean0 = mean(Adhere_shop_groceries, Adhere_shop_other, Adhere_meet_friends, sd = sd(Adhere_shop_groceries, Adhere_shop_other, Adhere_meet_friends), n=n(), se = sd/sqrt(n)))
gt(covid_data_investigate)| region | mean0 |
|---|---|
| 1 | 0.6172481 |
| 2 | 0.6425770 |
| 3 | 0.6199313 |
| 4 | 0.5570000 |
| 5 | 0.5895097 |
I then tried this: code (woont let me knit with the code attached)
covid_data_investigate <- assignment_data %>% group_by(region) %>% summarise(across = c(Adhere_shop_groceries, Adhere_shop_other, Adhere_meet_friends) %>% list(mean,sd, n=n(), se = sd/sqrt(n)))
The error i get: Error: Problem with summarise() input across. x non-numeric argument to mathematical function ℹ Input across is `%>%(…)`. ℹ The error occurred in group 1: region = 1.
Is the issue that for a group of variables I cant get an sd overall? Here is the graph I have created. I am wanting the sd so i can create error bars.
covid_data_investigate$region <- as.factor(covid_data_investigate$region)
graph_invest1 <- covid_data_investigate %>%
group_by(region) %>%
ggplot(mapping = aes(x = region, y = mean0, fill = region)) + geom_col() + labs(title = "Adhereance to lockdown measures in different UK Regionos", y = "average adhereance (0-1)") + ylim(0,1) + scale_fill_brewer(palette = "Blues")
print(graph_invest1)