Classwork 5

Graph Tables; Add Labels; Make Notes

Author

Byeong-Hak Choe

Published

February 10, 2025

Modified

February 17, 2025


library(tidyverse)
library(ggthemes)
library(socviz)
library(ggrepel)

# Setting a default ggplot theme 
theme_set(theme_fivethirtyeight() +
          theme(strip.background = element_rect(fill="lightgray"),
                axis.title.x = 
                  element_text(angle = 0,
                               size = rel(1.33),
                               margin = margin(10,0,0,0)),
                axis.title.y = 
                  element_text(angle = 90,
                               size = rel(1.33),
                               margin = margin(0,10,0,0))
                )
          )

Recreate the R code necessary to generate the following graphs.

Question 1

gss_sm <- socviz::gss_sm

DT::datatable(gss_sm) # displaying an interactive data.frame





Question 2

organdata <- socviz::organdata

DT::datatable(organdata)




Q2a



Q2b

Q2c



Q2d



Q2e



Q2f



Q2g




Question 3

mtcars <- datasets::mtcars
mtcars <- mtcars %>%   # A native pipe (|>) does not work here.
  mutate(car = rownames(.))
rownames(mtcars) <- 1:nrow(mtcars)

DT::datatable(mtcars)





Discussion

Welcome to our Classwork 5 Discussion Board! 👋

This space is designed for you to engage with your classmates about the material covered in Classwork 5.

Whether you are looking to delve deeper into the content, share insights, or have questions about the content, this is the perfect place for you.

If you have any specific questions for Byeong-Hak (@bcdanl) regarding the Classwork 5 materials or need clarification on any points, don’t hesitate to ask here.

All comments will be stored here.

Let’s collaborate and learn from each other!

Back to top