Last updated: 2021-12-06

Checks: 7 0

Knit directory: TidyTuesday/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20210215) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version fc5d76f. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rproj.user/

Untracked files:
    Untracked:  output/edges2.csv
    Untracked:  output/nodes2.csv

Unstaged changes:
    Modified:   analysis/_site.yml

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/du_bois.Rmd) and HTML (docs/du_bois.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
html 2144705 Nhi Hin 2021-03-16 Build site.
html 8c00d4d Nhi Hin 2021-03-02 Build site.
Rmd f129b00 Nhi Hin 2021-03-02 wflow_publish(c(“analysis/index.Rmd”, “analysis/du_bois.Rmd”,

https://github.com/rfordatascience/tidytuesday/blob/master/data/2021/2021-02-16/readme.md

Import data

# Github limit exceeded
# tuesdata <- tidytuesdayR::tt_load(2021, week = 8)

# Import spreadsheets in manually
georgia_pop <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-16/georgia_pop.csv')

── Column specification ────────────────────────────────────────────────────────
cols(
  Year = col_double(),
  Colored = col_double(),
  White = col_double()
)
census <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-16/census.csv')

── Column specification ────────────────────────────────────────────────────────
cols(
  region = col_character(),
  division = col_character(),
  year = col_double(),
  total = col_double(),
  white = col_double(),
  black = col_double(),
  black_free = col_double(),
  black_slaves = col_double()
)
furniture <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-16/furniture.csv')

── Column specification ────────────────────────────────────────────────────────
cols(
  Year = col_double(),
  `Houshold Value (Dollars)` = col_double()
)
city_rural <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-16/city_rural.csv')

── Column specification ────────────────────────────────────────────────────────
cols(
  Category = col_character(),
  Population = col_double()
)
income <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-16/income.csv')

── Column specification ────────────────────────────────────────────────────────
cols(
  Class = col_character(),
  `Actual Average` = col_double(),
  Rent = col_double(),
  Food = col_double(),
  Clothes = col_double(),
  Tax = col_double(),
  Other = col_double()
)
Warning: 1 parsing failure.
row col  expected    actual                                                                                                   file
  1  -- 7 columns 6 columns 'https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-16/income.csv'
freed_slaves <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-16/freed_slaves.csv')

── Column specification ────────────────────────────────────────────────────────
cols(
  Year = col_double(),
  Slave = col_double(),
  Free = col_double()
)
occupation <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-16/occupation.csv')

── Column specification ────────────────────────────────────────────────────────
cols(
  Group = col_character(),
  Occupation = col_character(),
  Percentage = col_double()
)
conjugal <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-16/conjugal.csv')

── Column specification ────────────────────────────────────────────────────────
cols(
  Population = col_character(),
  Age = col_character(),
  Single = col_double(),
  Married = col_double(),
  `Divorced and Widowed` = col_double()
)

Occupation

occupation %<>% mutate(Percentage = case_when(
  Group == "Negroes" ~ Percentage * -1,
  Group == "Whites" ~ Percentage
))

ggplot(occupation, aes(x = Occupation))+
  geom_bar(data = occupation[occupation$Group=="Negroes",],
           aes(y = Percentage, fill = Group), stat="identity") +
  geom_bar(data = occupation[occupation$Group=="Whites",],
           aes(y = Percentage, fill = Group), stat="identity") +
  geom_hline(yintercept=0, colour="white", lwd=1) +
  theme_minimal()+
  coord_flip(ylim=c(-100,100)) + 
  labs(y="Percent", x="Country") +
  ggtitle("Negroes                                                               Whites") 

Version Author Date
8c00d4d Nhi Hin 2021-03-02

Conjugal Condition

conjugal %>%
  melt(measure.vars = c("Single", "Married", "Divorced and Widowed")) %>%
  dplyr::rename(Conjugal_Condition = variable, 
                Percentage = value) %>%
  ggplot(aes(x = forcats::fct_rev(Population),
             y = Percentage,
             label = Percentage,
             fill = forcats::fct_rev(Conjugal_Condition))) +
  geom_bar(stat = "identity",
           #show.legend = FALSE
           ) +
  coord_flip() +
  facet_wrap(~Age, 
             ncol=1, 
             strip.position = "left") +
  scale_fill_manual(values = c("#40644c", "#f0a800", "#d4123c" ))+
  theme(panel.grid.major = element_blank(), 
        panel.grid.minor = element_blank(), 
        strip.placement = 'outside',
        rect = element_rect(fill = "transparent"),
        legend.position = "top") +
  labs(fill = "Conjugal Condition", 
       y = "Percentage (%)", x = "Population") +
  geom_text(size = 3,
            position = position_stack(vjust = 0.5), 
            color = "white") 

Version Author Date
8c00d4d Nhi Hin 2021-03-02

sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] LaCroixColoR_0.1.0 ggplot2_3.3.3      readr_1.4.0        magrittr_2.0.1    
[5] reshape2_1.4.4     dplyr_1.0.5        workflowr_1.6.2   

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.0  xfun_0.23         bslib_0.2.4       purrr_0.3.4      
 [5] colorspace_2.0-0  vctrs_0.3.7       generics_0.1.0    htmltools_0.5.1.1
 [9] yaml_2.2.1        utf8_1.1.4        rlang_0.4.10      jquerylib_0.1.3  
[13] later_1.1.0.1     pillar_1.6.0      glue_1.4.2        withr_2.3.0      
[17] DBI_1.1.0         lifecycle_1.0.0   plyr_1.8.6        stringr_1.4.0    
[21] munsell_0.5.0     gtable_0.3.0      evaluate_0.14     forcats_0.5.1    
[25] labeling_0.4.2    knitr_1.30        httpuv_1.5.4      curl_4.3         
[29] fansi_0.4.1       Rcpp_1.0.5        promises_1.1.1    scales_1.1.1     
[33] jsonlite_1.7.2    farver_2.0.3      fs_1.5.0          hms_1.0.0        
[37] digest_0.6.27     stringi_1.5.3     rprojroot_2.0.2   grid_4.0.3       
[41] cli_3.0.1         tools_4.0.3       sass_0.3.1        tibble_3.1.1     
[45] crayon_1.4.1      whisker_0.4       pkgconfig_2.0.3   ellipsis_0.3.1   
[49] assertthat_0.2.1  rmarkdown_2.8     rstudioapi_0.13   R6_2.5.0         
[53] git2r_0.27.1      compiler_4.0.3