Exercise 1

barnyard_ghg <- read.csv('https://usda-ree-ars.github.io/glmm-workshop-dec2022/datasets/barnyard_ghg.csv')

Exercise 2

One way to do this would be glimpse(barnyard_ghg) and table(barnyard_ghg$Surface).

Exercises 3-6

barnyard_ghg %>%  
  filter(Temp > 10) %>%
  group_by(Surface) %>%
  summarize(mean_CO2 = mean(CO2_mgC), mean_CH4 = mean(CH4_mgC), mean_NH3 = mean(NH3_ugN), mean_N2O = mean(N2O_ugN)) %>%
  arrange(mean_CO2)

Exercise 7

One way is:

pivot_longer(relig_income, cols = -religion)

or if you want to give your own names to the newly created columns,

pivot_longer(relig_income, cols = -religion, names_to = 'income', values_to = 'individuals')