Last updated: 2020-05-22

Checks: 7 0

Knit directory: wflow-dogs/analysis/

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(1) 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 08eed5a. 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:


working directory clean

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/dogs.Rmd) and HTML (docs/dogs.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
Rmd 08eed5a Peter Carbonetto 2020-05-22 wflow_publish(“dogs.Rmd”)
html 518b629 Peter Carbonetto 2020-05-22 Added text to “dogs” analysis.
Rmd fb4902b Peter Carbonetto 2020-05-22 wflow_publish(“dogs.Rmd”)
html cdc0b7f Peter Carbonetto 2020-05-22 Fixed the plot in the “dogs” analysis.
Rmd d67bc16 Peter Carbonetto 2020-05-22 wflow_publish(“dogs.Rmd”)
html 32ed135 Peter Carbonetto 2020-05-22 Made some adjustments to the “dogs” analysis.
Rmd 0f6814c Peter Carbonetto 2020-05-22 wflow_publish(“dogs.Rmd”)
html f5b2311 Peter Carbonetto 2020-05-22 Generated “dogs” webpage for first time.
Rmd 0306062 Peter Carbonetto 2020-05-22 wflow_publish(“dogs.Rmd”)
Rmd 78f3e0f Peter Carbonetto 2020-05-22 Fixed workflowr settings and added dogs.Rmd.

It is well-known that small dog breeds live longer than larger-sized breeds. Here we verify this using data from the paper, “Single-nucleotide- polymorphism-based association mapping of dog stereotypes,” Jones et al, Genetics, 2008.

The ggplot2 and cowplot packages are used to create the scatterplot below.

library(ggplot2)
library(cowplot)

Import data

Read the height, weight and age-of-death (AOD) data for different dog breeds. These data accompany Jones et al, 2008.

dogs <- read.csv("../data/dogs.csv",stringsAsFactors = FALSE)

Find “best-fit” line

Find the line that best predicts AOD given body weight (in pounds).

fit <- lm(AOD ~ weight,dogs)
b   <- coef(fit)

Plot AOD vs. body weight

Plot age-of-death vs. body weight, and the best-fit line (this is the dashed blue line). Compare with Fig. 4 of Jones et al (2008).

ggplot(dogs,aes(x = weight,y = AOD)) +
  geom_point(color = "black") +
  geom_abline(intercept = b["(Intercept)"],slope = b["weight"],
              color = "darkorange",linetype = "dashed") +
  theme_cowplot()

Version Author Date
cdc0b7f Peter Carbonetto 2020-05-22

sessionInfo()
# R version 3.6.2 (2019-12-12)
# Platform: x86_64-apple-darwin15.6.0 (64-bit)
# Running under: macOS Catalina 10.15.4
# 
# Matrix products: default
# BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
# LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
# 
# locale:
# [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
# 
# attached base packages:
# [1] stats     graphics  grDevices utils     datasets  methods   base     
# 
# other attached packages:
# [1] cowplot_1.0.0 ggplot2_3.3.0
# 
# loaded via a namespace (and not attached):
#  [1] Rcpp_1.0.3       compiler_3.6.2   pillar_1.4.3     later_1.0.0     
#  [5] git2r_0.26.1     workflowr_1.6.2  tools_3.6.2      digest_0.6.23   
#  [9] evaluate_0.14    lifecycle_0.1.0  tibble_2.1.3     gtable_0.3.0    
# [13] pkgconfig_2.0.3  rlang_0.4.5      yaml_2.2.0       xfun_0.11       
# [17] withr_2.1.2      stringr_1.4.0    dplyr_0.8.3      knitr_1.26      
# [21] fs_1.3.1         rprojroot_1.3-2  grid_3.6.2       tidyselect_0.2.5
# [25] glue_1.3.1       R6_2.4.1         rmarkdown_2.0    farver_2.0.1    
# [29] purrr_0.3.3      magrittr_1.5     whisker_0.4      backports_1.1.5 
# [33] scales_1.1.0     promises_1.1.0   htmltools_0.4.0  assertthat_0.2.1
# [37] colorspace_1.4-1 httpuv_1.5.2     labeling_0.3     stringi_1.4.3   
# [41] munsell_0.5.0    crayon_1.3.4