diff --git a/DESCRIPTION b/DESCRIPTION index a89e0d7..a2a5649 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -65,6 +65,7 @@ Suggests: ggtext, here, hexSticker, + hrbrthemes, knitr, purrr, readr, diff --git a/NAMESPACE b/NAMESPACE index 65dc85d..e7c1b9f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -16,6 +16,8 @@ export(pool_taxon_counts) export(read_dist) export(read_tax) export(set_knitr_opts) +export(theme_lucas) +export(theme_sovacool) importFrom(dplyr,"%>%") importFrom(formatR,tidy_source) importFrom(rlang,.data) diff --git a/NEWS.md b/NEWS.md index e6cf098..3e8825c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,6 +7,9 @@ taxonomic resolutions, as seen in (#37, @kelly-sovacool). - New function `calc_relabun()` calculates OTU relative abundances (#38, @kelly-sovacool). +- New custom themes for ggplot2: + - `theme_sovacool()` (#39, @kelly-sovacool) + - `theme_lucas()` (#40, @sklucas) # schtools 0.2.1 diff --git a/R/plot.R b/R/plot.R new file mode 100644 index 0000000..c1c2adc --- /dev/null +++ b/R/plot.R @@ -0,0 +1,76 @@ +#' Kelly's go-to theme for ggplot2 +#' +#' Uses `ggplot2::theme_bw()` and removes margins. +#' +#' @return list of ggproto objects +#' +#' @export +#' @author Kelly Sovacool \email{sovacool@@umich.edu} +#' +#' @examples +#' library(ggplot2) +#' ggplot(mtcars) + +#' aes(x = mpg, y = wt, color = cyl) + +#' geom_point() + +#' theme_sovacool() +theme_sovacool <- function() { + return(list( + ggplot2::theme_bw(), + ggplot2::theme( + legend.margin = ggplot2::margin(0, 0, 0, 0, unit = "pt"), + legend.box.margin = ggplot2::margin(0, 0, 0, 0, unit = "pt"), + plot.margin = ggplot2::margin(0, 0, 0, 0, unit = "pt") + ) + )) +} +#' Sarah's go-to theme for ggplot2 +#' +#' Requires the `hrbrthemes` package and the `PT Sans` and `PT Sans Narrow` +#' fonts from Google Fonts. +#' +#' @return list of ggproto objects +#' @export +#' @author Sarah Lucas \email{salucas@@umich.edu} +#' +#' @examples +#' library(ggplot2) +#' library(showtext) +#' +#' # run once to download the PT Sans fonts +#' font_add_google(name = "PT Sans", family = "PT Sans") +#' font_add_google(name = "PT Sans Narrow", family = "PT Sans Narrow") +#' showtext_auto() +#' +#' # make a plot with theme_lucas() +#' ggplot(mtcars) + +#' aes(x = mpg, y = wt, color = cyl) + +#' geom_point() + +#' theme_lucas() +theme_lucas <- function() { + return(list( + hrbrthemes::theme_ipsum( + base_family = "PT Sans", + base_size = 20, + axis_title_family = "PT Sans Narrow", + axis_title_size = 20, + axis_text_size = 16, + axis_title_just = "c" + ), + ggplot2::theme( + plot.title = ggplot2::element_text(hjust = 0.5), + plot.subtitle = ggplot2::element_text(hjust = 0.5), + plot.margin = ggplot2::margin(15, 15, 15, 15), + panel.grid.minor = ggplot2::element_blank(), + panel.background = ggplot2::element_blank(), + legend.position = "bottom", + legend.key = ggplot2::element_rect( + fill = "white", color = "white", size = 4 + ), + legend.key.width = ggplot2::unit(2, "cm"), + legend.text = ggplot2::element_text(size = 12), + plot.caption = ggplot2::element_text( + color = "#85919b", hjust = 0, size = 12, face = "plain" + ) + ) + )) +} diff --git a/README.md b/README.md index d65b8d4..d7ad7c6 100644 --- a/README.md +++ b/README.md @@ -88,19 +88,25 @@ license](https://github.com/SchlossLab/schtools/blob/main/LICENSE.md#creative-co To cite schtools in publications, use: +> +> >

+> > Sovacool K, Lesniak N, Schloss P (2022). schtools: Schloss Lab -> Tools for Reproducible Microbiome Research. R package version -> 0.2.1, -> https://CRAN.R-project.org/package=schtools. +> Tools for Reproducible Microbiome Research. +> , +> . +> >

A BibTeX entry for LaTeX users is: - @Manual{, - title = {schtools: Schloss Lab Tools for Reproducible Microbiome Research}, - author = {Kelly Sovacool and Nick Lesniak and Patrick Schloss}, - year = {2022}, - note = {R package version 0.2.1}, - url = {https://CRAN.R-project.org/package=schtools}, - } +``` + @Manual{, + title = {schtools: Schloss Lab Tools for Reproducible Microbiome Research}, + author = {Kelly Sovacool and Nick Lesniak and Patrick Schloss}, + year = {2022}, + note = {http://www.schlosslab.org/schtools/, +https://github.com/SchlossLab/schtools}, +} +``` diff --git a/_pkgdown.yml b/_pkgdown.yml index 1ecc013..969cad6 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -46,3 +46,4 @@ reference: - is_nondesc - load_deps - log_snakemake + - starts_with('theme_') diff --git a/docs/dev/index.html b/docs/dev/index.html index c6f41d7..1c32884 100644 --- a/docs/dev/index.html +++ b/docs/dev/index.html @@ -98,14 +98,14 @@

Installation

-

You can install the latest release from CRAN:

+

You can install the latest release from CRAN:

 install.packages("schtools")

or the development version from GitHub with:

 # install.packages("devtools")
 devtools::install_github("SchlossLab/schtools")
-

or install from a terminal using conda or mamba:

+

or install from a terminal using conda or mamba:

mamba install -c conda-forge r-schtools
diff --git a/docs/dev/pkgdown.yml b/docs/dev/pkgdown.yml index 188c2eb..c8e0a02 100644 --- a/docs/dev/pkgdown.yml +++ b/docs/dev/pkgdown.yml @@ -4,7 +4,7 @@ pkgdown_sha: ~ articles: logo: logo.html introduction: introduction.html -last_built: 2022-09-26T21:08Z +last_built: 2022-10-04T20:47Z urls: reference: http://www.schlosslab.org/schtools/reference article: http://www.schlosslab.org/schtools/articles diff --git a/docs/dev/reference/Rplot001.png b/docs/dev/reference/Rplot001.png index 17a3580..12befe1 100644 Binary files a/docs/dev/reference/Rplot001.png and b/docs/dev/reference/Rplot001.png differ diff --git a/docs/dev/reference/calc_relabun.html b/docs/dev/reference/calc_relabun.html index 1e0681e..0658456 100644 --- a/docs/dev/reference/calc_relabun.html +++ b/docs/dev/reference/calc_relabun.html @@ -85,7 +85,8 @@

Author<

Examples

shared_dat <- readr::read_tsv(system.file("extdata", "test.shared",
-                                          package = "schtools"))
+  package = "schtools"
+))
 #> Rows: 10 Columns: 15
 #> ── Column specification ────────────────────────────────────────────────────────
 #> Delimiter: "\t"
diff --git a/docs/dev/reference/index.html b/docs/dev/reference/index.html
index 8c421d4..44bc891 100644
--- a/docs/dev/reference/index.html
+++ b/docs/dev/reference/index.html
@@ -170,6 +170,16 @@ 

Everything elselog_snakemake()
Save output, messages, warnings, and errors to the Snakemake log file
+
+ + theme_lucas() +
+
Sarah's go-to theme for ggplot2
+
+ + theme_sovacool() +
+
Kelly's go-to theme for ggplot2

diff --git a/docs/dev/reference/theme_lucas-1.png b/docs/dev/reference/theme_lucas-1.png new file mode 100644 index 0000000..b0b6c72 Binary files /dev/null and b/docs/dev/reference/theme_lucas-1.png differ diff --git a/docs/dev/reference/theme_lucas.html b/docs/dev/reference/theme_lucas.html new file mode 100644 index 0000000..a74a9e0 --- /dev/null +++ b/docs/dev/reference/theme_lucas.html @@ -0,0 +1,118 @@ + +Sarah's go-to theme for ggplot2 — theme_lucas • schtools + Skip to contents + + +
+
+
+ +
+

Requires the hrbrthemes package and the PT Sans and PT Sans Narrow +fonts from Google Fonts.

+
+ +
+

Usage

+
theme_lucas()
+
+ +
+

Value

+ + +

list of ggproto objects

+
+
+

Author

+

Sarah Lucas salucas@umich.edu

+
+ +
+

Examples

+
library(ggplot2)
+library(showtext)
+#> Loading required package: sysfonts
+#> Loading required package: showtextdb
+
+# run once to download the PT Sans fonts
+font_add_google(name = "PT Sans", family = "PT Sans")
+font_add_google(name = "PT Sans Narrow", family = "PT Sans Narrow")
+showtext_auto()
+
+# make a plot with theme_lucas()
+ggplot(mtcars) +
+  aes(x = mpg, y = wt, color = cyl) +
+  geom_point() +
+  theme_lucas()
+
+
+
+
+ + +
+ + + + + + + diff --git a/docs/dev/reference/theme_sovacool-1.png b/docs/dev/reference/theme_sovacool-1.png new file mode 100644 index 0000000..f734228 Binary files /dev/null and b/docs/dev/reference/theme_sovacool-1.png differ diff --git a/docs/dev/reference/theme_sovacool.html b/docs/dev/reference/theme_sovacool.html new file mode 100644 index 0000000..cc68035 --- /dev/null +++ b/docs/dev/reference/theme_sovacool.html @@ -0,0 +1,105 @@ + +Kelly's go-to theme for ggplot2 — theme_sovacool • schtools + Skip to contents + + +
+
+
+ +
+

Uses ggplot2::theme_bw() and removes margins.

+
+ +
+

Usage

+
theme_sovacool()
+
+ +
+

Value

+ + +

list of ggproto objects

+
+
+

Author

+

Kelly Sovacool sovacool@umich.edu

+
+ +
+

Examples

+
library(ggplot2)
+ggplot(mtcars) +
+  aes(x = mpg, y = wt, color = cyl) +
+  geom_point() +
+  theme_sovacool()
+
+
+
+
+ + +
+ + + + + + + diff --git a/docs/dev/search.json b/docs/dev/search.json index 01993b2..d909c05 100644 --- a/docs/dev/search.json +++ b/docs/dev/search.json @@ -1 +1 @@ -[{"path":[]},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"our-pledge","dir":"","previous_headings":"","what":"Our Pledge","title":"Contributor Covenant Code of Conduct","text":"members, contributors, leaders pledge make participation community harassment-free experience everyone, regardless age, body size, visible invisible disability, ethnicity, sex characteristics, gender identity expression, level experience, education, socio-economic status, nationality, personal appearance, race, religion, sexual identity orientation. pledge act interact ways contribute open, welcoming, diverse, inclusive, healthy community.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"our-standards","dir":"","previous_headings":"","what":"Our Standards","title":"Contributor Covenant Code of Conduct","text":"Examples behavior contributes positive environment community include: Demonstrating empathy kindness toward people respectful differing opinions, viewpoints, experiences Giving gracefully accepting constructive feedback Accepting responsibility apologizing affected mistakes, learning experience Focusing best just us individuals, overall community Examples unacceptable behavior include: use sexualized language imagery, sexual attention advances kind Trolling, insulting derogatory comments, personal political attacks Public private harassment Publishing others’ private information, physical email address, without explicit permission conduct reasonably considered inappropriate professional setting","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"enforcement-responsibilities","dir":"","previous_headings":"","what":"Enforcement Responsibilities","title":"Contributor Covenant Code of Conduct","text":"Community leaders responsible clarifying enforcing standards acceptable behavior take appropriate fair corrective action response behavior deem inappropriate, threatening, offensive, harmful. Community leaders right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct, communicate reasons moderation decisions appropriate.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"scope","dir":"","previous_headings":"","what":"Scope","title":"Contributor Covenant Code of Conduct","text":"Code Conduct applies within community spaces, also applies individual officially representing community public spaces. Examples representing community include using official e-mail address, posting via official social media account, acting appointed representative online offline event.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"enforcement","dir":"","previous_headings":"","what":"Enforcement","title":"Contributor Covenant Code of Conduct","text":"Instances abusive, harassing, otherwise unacceptable behavior may reported community leaders responsible enforcement [INSERT CONTACT METHOD]. complaints reviewed investigated promptly fairly. community leaders obligated respect privacy security reporter incident.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"enforcement-guidelines","dir":"","previous_headings":"","what":"Enforcement Guidelines","title":"Contributor Covenant Code of Conduct","text":"Community leaders follow Community Impact Guidelines determining consequences action deem violation Code Conduct:","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"1-correction","dir":"","previous_headings":"Enforcement Guidelines","what":"1. Correction","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Use inappropriate language behavior deemed unprofessional unwelcome community. Consequence: private, written warning community leaders, providing clarity around nature violation explanation behavior inappropriate. public apology may requested.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"2-warning","dir":"","previous_headings":"Enforcement Guidelines","what":"2. Warning","title":"Contributor Covenant Code of Conduct","text":"Community Impact: violation single incident series actions. Consequence: warning consequences continued behavior. interaction people involved, including unsolicited interaction enforcing Code Conduct, specified period time. includes avoiding interactions community spaces well external channels like social media. Violating terms may lead temporary permanent ban.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"3-temporary-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"3. Temporary Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: serious violation community standards, including sustained inappropriate behavior. Consequence: temporary ban sort interaction public communication community specified period time. public private interaction people involved, including unsolicited interaction enforcing Code Conduct, allowed period. Violating terms may lead permanent ban.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"4-permanent-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"4. Permanent Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Demonstrating pattern violation community standards, including sustained inappropriate behavior, harassment individual, aggression toward disparagement classes individuals. Consequence: permanent ban sort public interaction within community.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Contributor Covenant Code of Conduct","text":"Code Conduct adapted Contributor Covenant, version 2.0, available https://www.contributor-covenant.org/version/2/0/ code_of_conduct.html. Community Impact Guidelines inspired Mozilla’s code conduct enforcement ladder. answers common questions code conduct, see FAQ https://www.contributor-covenant.org/faq. Translations available https:// www.contributor-covenant.org/translations.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to schtools","title":"Contributing to schtools","text":"outlines propose change schtools. detailed info contributing , tidyverse packages, please see development contributing guide.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to schtools","text":"can fix typos, spelling mistakes, grammatical errors documentation directly using GitHub web interface, long changes made source file. generally means ’ll need edit roxygen2 comments .R, .Rd file. can find .R file generates .Rd reading comment first line.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CONTRIBUTING.html","id":"bigger-changes","dir":"","previous_headings":"","what":"Bigger changes","title":"Contributing to schtools","text":"want make bigger change, ’s good idea first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed).","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Bigger changes","what":"Pull request process","title":"Contributing to schtools","text":"Fork package clone onto computer. haven’t done , recommend using usethis::create_from_github(\"SchlossLab/schtools\", fork = TRUE). Install development dependences devtools::install_dev_deps(), make sure package passes R CMD check running devtools::check(). R CMD check doesn’t pass cleanly, ’s good idea ask help continuing. Create Git branch pull request (PR). recommend using usethis::pr_init(\"brief-description--change\"). Make changes, commit git, create PR running usethis::pr_push(), following prompts browser. title PR briefly describe change. body PR contain Fixes #issue-number. user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Bigger changes","what":"Code style","title":"Contributing to schtools","text":"New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat unit tests. Contributions test cases included easier accept.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to schtools","text":"Please note schtools project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"License","title":"License","text":"software licensed MIT License. Everything else licensed CC -SA license.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/LICENSE.html","id":"mit-license","dir":"","previous_headings":"","what":"MIT License","title":"License","text":"Copyright (c) 2021 Kelly L. Sovacool, Nick Lesniak, Patrick D. Schloss Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/LICENSE.html","id":"creative-commons-share-alike-license","dir":"","previous_headings":"","what":"Creative Commons Share Alike License","title":"License","text":"schtools logo licensed CC -SA 4.0 license. hammer poo images contained logo designed OpenMoji, open-source emoji icon project, also licensed CC -SA 4.0.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/SUPPORT.html","id":null,"dir":"","previous_headings":"","what":"Getting help with schtools","title":"Getting help with schtools","text":"Thanks using schtools! filing issue, places explore pieces put together make process smooth possible.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/SUPPORT.html","id":"make-a-reprex","dir":"","previous_headings":"","what":"Make a reprex","title":"Getting help with schtools","text":"Start making minimal reproducible example using reprex package. haven’t heard used reprex , ’re treat! Seriously, reprex make R-question-asking endeavors easier (pretty insane ROI five ten minutes ’ll take learn ’s ). additional reprex pointers, check Get help! section tidyverse site.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/SUPPORT.html","id":"where-to-ask","dir":"","previous_headings":"","what":"Where to ask?","title":"Getting help with schtools","text":"Armed reprex, next step figure ask. ’s question: start community.rstudio.com, /StackOverflow. people answer questions. ’s bug: ’re right place, file issue. ’re sure: let community help figure ! problem bug feature request, can easily return report . opening new issue, sure search issues pull requests make sure bug hasn’t reported /already fixed development version. default, search pre-populated :issue :open. can edit qualifiers (e.g. :pr, :closed) needed. example, ’d simply remove :open search issues repo, open closed.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/SUPPORT.html","id":"what-happens-next","dir":"","previous_headings":"","what":"What happens next?","title":"Getting help with schtools","text":"efficient possible, development tidyverse packages tends bursty, shouldn’t worry don’t get immediate response. Typically don’t look repo sufficient quantity issues accumulates, ’s burst intense activity focus efforts. makes development efficient avoids expensive context switching problems, cost taking longer get back . process makes good reprex particularly important might multiple months initial report start working . can’t reproduce bug, can’t fix !","code":""},{"path":[]},{"path":"http://www.schlosslab.org/schtools/dev/articles/introduction.html","id":"calculate-relative-abundances","dir":"Articles","previous_headings":"Handling mothur data","what":"Calculate relative abundances","title":"Introduction to schtools","text":"can read shared file calculate relative abundances calc_relabun(): calc_relabun() returns data frame long format. can use tidyr::pivot_wider() convert wide format: can see relative abundances sample sum 1:","code":"shared_dat <- read_tsv(system.file(\"extdata\", \"test.shared\", package = \"schtools\")) #> Rows: 10 Columns: 15 #> ── Column specification ──────────────────────────────────────────────────────── #> Delimiter: \"\\t\" #> chr (1): Group #> dbl (14): label, numOtus, Otu0001, Otu0003, Otu0004, Otu00008, Otu0044, Otu0... #> #> ℹ Use `spec()` to retrieve the full column specification for this data. #> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message. relabun_dat <- shared_dat %>% calc_relabun() head(relabun_dat) #> # A tibble: 6 × 3 #> sample otu rel_abun #> #> 1 p1 Otu0001 0 #> 2 p1 Otu0003 0 #> 3 p1 Otu0004 0 #> 4 p1 Otu00008 0 #> 5 p1 Otu0044 0.25 #> 6 p1 Otu0056 0.25 wide_dat <- relabun_dat %>% pivot_wider(names_from = \"otu\", values_from = \"rel_abun\") head(wide_dat) #> # A tibble: 6 × 13 #> sample Otu0001 Otu0003 Otu0004 Otu00…¹ Otu0044 Otu0056 Otu0057 Otu0058 Otu0159 #> #> 1 p1 0 0 0 0 0.25 0.25 0 0.25 0 #> 2 p2 0.167 0 0.167 0 0.167 0 0 0.167 0 #> 3 p3 0 0.2 0 0 0.2 0 0 0 0.2 #> 4 p4 0.25 0.25 0 0.25 0 0 0 0 0 #> 5 p5 0.25 0 0.25 0 0.25 0 0 0 0 #> 6 p6 0.167 0 0 0.167 0 0.167 0.167 0.167 0 #> # … with 3 more variables: Otu0208 , Otu0328 , Otu0329 , and #> # abbreviated variable name ¹​Otu00008 wide_dat %>% select(starts_with(\"Otu\")) %>% rowSums() #> [1] 1 1 1 1 1 1 1 1 1 1"},{"path":"http://www.schlosslab.org/schtools/dev/articles/introduction.html","id":"taxonomy-files","dir":"Articles","previous_headings":"Handling mothur data","what":"Taxonomy files","title":"Introduction to schtools","text":"mothur formats taxonomy files tab-separated values (tsv). can use read_tax() parse taxonomy data create separate columns taxonomic level. column label_html provides html correctly italicizes genus name without italicizing OTU label. can used ggtext::element_markdown() make nice plots:","code":"tax_dat <- read_tax(system.file(\"extdata\", \"test.taxonomy\", package = \"schtools\")) head(tax_dat) #> # A tibble: 6 × 10 #> otu otu_label tax_otu_l…¹ label…² kingdom phylum class order family genus #> #> 1 Otu0001 OTU 1 Bacteroide… Bac… Bacter… Bacte… Bact… Bact… Bacte… Bact… #> 2 Otu0003 OTU 3 Porphyromo… Por… Bacter… Bacte… Bact… Bact… Porph… Porp… #> 3 Otu0004 OTU 4 Porphyromo… Por… Bacter… Bacte… Bact… Bact… Porph… Porp… #> 4 Otu00008 OTU 8 Enterobact… Ent… Bacter… Prote… Gamm… Ente… Enter… Ente… #> 5 Otu0044 OTU 44 Bacteria (… Bac… Bacter… Bacte… Bact… Bact… Bacte… Bact… #> 6 Otu0056 OTU 56 Bacteria (… Bac… Bacter… Bacte… Bact… Bact… Bacte… Bact… #> # … with abbreviated variable names ¹​tax_otu_label, ²​label_html library(ggtext) set.seed(20220427) relabun_dat %>% mutate(sample_num = stringr::str_remove(sample, \"p\") %>% as.integer(), treatment = case_when(sample_num%%2 == 1 ~ \"A\", TRUE ~ \"B\")) %>% inner_join(tax_dat, by = \"otu\") %>% ggplot(aes(x = rel_abun, y = label_html, color = treatment)) + geom_jitter(alpha = 0.7, height = 0.2) + labs(x = \"Relative abundance\", y = \"\") + theme_minimal() + theme(axis.text.y = element_markdown())"},{"path":"http://www.schlosslab.org/schtools/dev/articles/introduction.html","id":"pooling-otu-counts-at-different-taxonomic-levels","dir":"Articles","previous_headings":"Handling mothur data > Taxonomy files","what":"Pooling OTU counts at different taxonomic levels","title":"Introduction to schtools","text":"common task repeat OTU-level analyses different taxonomic levels determine resolution optimal answering questions. ’ll need shared file, generated clustering sequences OTUs mothur, corresponding taxonomy file. Take look mothur documentation info generating files performing microbiome analyses. example, pool_taxon_counts() pools OTU counts shared file genus level returns new shared taxonomy data frames. can taxonomic level taxonomy data frame.","code":"tax_dat <- read_tax(system.file(\"extdata\", \"test.taxonomy\", package = \"schtools\")) shared_dat <- readr::read_tsv(system.file(\"extdata\", \"test.shared\", package = \"schtools\")) #> Rows: 10 Columns: 15 #> ── Column specification ──────────────────────────────────────────────────────── #> Delimiter: \"\\t\" #> chr (1): Group #> dbl (14): label, numOtus, Otu0001, Otu0003, Otu0004, Otu00008, Otu0044, Otu0... #> #> ℹ Use `spec()` to retrieve the full column specification for this data. #> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message. pool_taxon_counts(shared_dat, tax_dat, genus) #> $shared #> # A tibble: 10 × 13 #> label Group numOtus Otu01 Otu02 Otu03 Otu04 Otu05 Otu06 Otu07 Otu08 Otu09 #> #> 1 genus p1 10 0 0 0 2 0 1 0 1 0 #> 2 genus p10 10 1 0 1 0 1 0 1 1 1 #> 3 genus p2 10 1 1 0 1 0 1 0 0 1 #> 4 genus p3 10 0 1 0 1 0 0 1 0 1 #> 5 genus p4 10 1 1 1 0 0 0 0 0 0 #> 6 genus p5 10 1 1 0 1 0 0 0 0 1 #> 7 genus p6 10 1 0 1 1 1 1 0 0 1 #> 8 genus p7 10 0 0 0 1 1 0 1 0 1 #> 9 genus p8 10 0 1 1 2 0 0 1 1 0 #> 10 genus p9 10 0 1 1 2 0 0 1 1 1 #> # … with 1 more variable: Otu10 #> #> $tax #> # A tibble: 10 × 3 #> otu size genus #> #> 1 Otu01 5 Bacteroides #> 2 Otu02 6 Porphyromonadaceae unclassified #> 3 Otu03 5 Enterobacteriaceae unclassified #> 4 Otu04 11 Bacteria unclassified #> 5 Otu05 3 Acinetobacter #> 6 Otu06 3 Clostridium XlVa #> 7 Otu07 5 Betaproteobacteria unclassified #> 8 Otu08 4 Clostridium XVIII #> 9 Otu09 7 Candidatus Saccharibacteria unclassified #> 10 Otu10 5 Clostridiales Incertae Sedis XIII unclassified pool_taxon_counts(shared_dat, tax_dat, phylum) #> $shared #> # A tibble: 10 × 8 #> label Group numOtus Otu1 Otu2 Otu3 Otu4 Otu5 #> #> 1 phylum p1 5 0 0 2 2 0 #> 2 phylum p10 5 1 3 0 1 1 #> 3 phylum p2 5 2 0 1 2 1 #> 4 phylum p3 5 1 1 1 1 1 #> 5 phylum p4 5 2 1 0 1 0 #> 6 phylum p5 5 2 0 1 0 1 #> 7 phylum p6 5 1 2 1 1 1 #> 8 phylum p7 5 0 2 1 1 1 #> 9 phylum p8 5 1 2 2 1 0 #> 10 phylum p9 5 1 2 2 2 1 #> #> $tax #> # A tibble: 5 × 3 #> otu size phylum #> #> 1 Otu1 11 Bacteroidetes #> 2 Otu2 13 Proteobacteria #> 3 Otu3 11 Bacteria unclassified #> 4 Otu4 12 Firmicutes #> 5 Otu5 7 Candidatus Saccharibacteria"},{"path":"http://www.schlosslab.org/schtools/dev/articles/introduction.html","id":"distance-files","dir":"Articles","previous_headings":"Handling mothur data","what":"Distance files","title":"Introduction to schtools","text":"distance file saved phylip-formatted lower triangle matrix mothur’s dist.seqs command, can read R read_dist():","code":"dist_filepath <- system.file(\"extdata\", \"sample.final.thetayc.0.03.lt.ave.dist\", package = \"schtools\") dist_tbl <- read_dist(dist_filepath) head(dist_tbl) #> # A tibble: 6 × 3 #> rows columns distances #> #> 1 104_1_D1 104_1_D0 0.893 #> 2 104_1_D10 104_1_D0 0.254 #> 3 104_1_D10 104_1_D1 0.922 #> 4 104_1_D2 104_1_D0 0.874 #> 5 104_1_D2 104_1_D1 0.109 #> 6 104_1_D2 104_1_D10 0.904"},{"path":"http://www.schlosslab.org/schtools/dev/articles/introduction.html","id":"r-markdown-helpers-for-scientific-writing","dir":"Articles","previous_headings":"","what":"R Markdown helpers for scientific writing","title":"Introduction to schtools","text":"writing scientific papers R Markdown, often find using knitr chunk options miscellaneous helper functions. use favorite options like eval=TRUE, echo=FALSE, others, run set_knitr_opts() first chunk R Markdown document: also sets inline hook custom inline_hook() function, automatically formats numbers human-readable way inserts Oxford comma lists needed.","code":"```{r, include = FALSE} set_knitr_opts() ```"},{"path":"http://www.schlosslab.org/schtools/dev/articles/introduction.html","id":"who-doesnt-love-an-oxford-comma","dir":"Articles","previous_headings":"R Markdown helpers for scientific writing","what":"Who doesn’t love an Oxford comma?","title":"Introduction to schtools","text":"writing R Markdown, may wish insert list vector inline correctly format Oxford comma. inline_hook() uses paste_oxford_list() help just ! Insert string inline code `r `: `r animals` common pets. Rendered output: cats, dogs, fish common pets.","code":"animals <- c(\"cats\", \"dogs\", \"fish\")"},{"path":"http://www.schlosslab.org/schtools/dev/articles/introduction.html","id":"human-readable-numbers","dir":"Articles","previous_headings":"R Markdown helpers for scientific writing","what":"Human-readable numbers","title":"Introduction to schtools","text":"inline_hook() uses format_numbers() hood automatically format numbers human-readable format, rather display scientific notation. numbers `r c(1e-04, 1e-05, 1e-06)` precise, `r c(1e04, 1e05, 1e06)` large. Rendered output: numbers 0.0001, 0.00001, 0.000001 precise. 10,000, 100,000, 1,000,000 large.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/articles/logo.html","id":"emojis","dir":"Articles","previous_headings":"","what":"Emojis","title":"logo","text":"OpenMoji, licensed CC -SA 4.0 poop: https://openmoji.org/library/#search=poo&emoji=1F4A9 wrench: https://openmoji.org/library/#search=tool&emoji=1F527 hammer: https://openmoji.org/library/#search=tool&emoji=1F528","code":"poo_file <- here('vignettes', 'articles','1F4A9_color.png') wrench_file <- here('vignettes', 'articles', '1F527_color.png') hammer_file <- here('vignettes', 'articles', '1F528_color.png') img <- ggdraw() + #draw_image(wrench_file, scale = 0.55, x = 0.195, y = 0.05) + draw_image(hammer_file, scale = 0.7, x = -0.32, y = 0.05) + draw_image(poo_file) ggsave2(img, filename = here('vignettes', 'articles', 'poo-hammer.png'), height = 2, width = 2, units = 'in') img"},{"path":"http://www.schlosslab.org/schtools/dev/articles/logo.html","id":"schtools-logo","dir":"Articles","previous_headings":"","what":"Schtools Logo","title":"logo","text":"","code":"mint <- '#A2EAE0' pink <- '#FA9DC5' orange <- '#FFDBAD' black <- '#000000' logo_filename <- here('vignettes', 'articles', 'schtools-logo.png') sticker(img, package = 'schtools', s_x = 1, s_y = 0.85, s_width = 1.6, s_height = 1.6, p_x = 1, p_y = 1.55, p_color = black, p_size = 23, p_family = 'Source Sans Pro', h_fill = mint, h_color = orange, url = 'schlosslab.org/schtools', u_size = 3.5, filename = logo_filename) ggdraw() + draw_image(logo_filename)"},{"path":"http://www.schlosslab.org/schtools/dev/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Kelly Sovacool. Author, maintainer. Nick Lesniak. Author. Patrick Schloss. Author. Sarah Lucas. Contributor. Courtney Armour. Contributor. Jacqueline Moltzau. Contributor. Andrew Hannah. Contributor. Nielson Baxter. Contributor. Alyxandria Schubert. Contributor. Kathryn Iverson. Contributor.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Sovacool K, Lesniak N, Schloss P (2022). schtools: Schloss Lab Tools Reproducible Microbiome Research. http://www.schlosslab.org/schtools/, https://github.com/SchlossLab/schtools.","code":"@Manual{, title = {schtools: Schloss Lab Tools for Reproducible Microbiome Research}, author = {Kelly Sovacool and Nick Lesniak and Patrick Schloss}, year = {2022}, note = {http://www.schlosslab.org/schtools/, https://github.com/SchlossLab/schtools}, }"},{"path":"http://www.schlosslab.org/schtools/dev/index.html","id":"schtools-","dir":"","previous_headings":"","what":"Schloss Lab Tools for Reproducible Microbiome Research","title":"Schloss Lab Tools for Reproducible Microbiome Research","text":"Schloss Lab Tools Reproducible Microbiome Research 💩 collection useful functions example code created used Schloss Lab reproducible microbiome research. Perform common tasks like read output files mothur, tidy microbiome data, format rmarkdown documents publication. See website information, documentation, examples.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Schloss Lab Tools for Reproducible Microbiome Research","text":"can install latest release CRAN: development version GitHub : install terminal using conda mamba:","code":"install.packages(\"schtools\") # install.packages(\"devtools\") devtools::install_github(\"SchlossLab/schtools\") mamba install -c conda-forge r-schtools"},{"path":"http://www.schlosslab.org/schtools/dev/index.html","id":"usage","dir":"","previous_headings":"","what":"Usage","title":"Schloss Lab Tools for Reproducible Microbiome Research","text":"Check introductory vignette quick start tutorial take look reference documentation comprehensive list functions.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/index.html","id":"help--contributing","dir":"","previous_headings":"","what":"Help & Contributing","title":"Schloss Lab Tools for Reproducible Microbiome Research","text":"questions, create new post Discussions. come across bug, open issue include minimal reproducible example. ’d like contribute, see guidelines .","code":""},{"path":"http://www.schlosslab.org/schtools/dev/index.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Schloss Lab Tools for Reproducible Microbiome Research","text":"Please note schtools project released Contributor Code Conduct. contributing project, agree abide terms.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/index.html","id":"license","dir":"","previous_headings":"","what":"License","title":"Schloss Lab Tools for Reproducible Microbiome Research","text":"schtools package licensed MIT license. logo licensed CC -SA license.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/index.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Schloss Lab Tools for Reproducible Microbiome Research","text":"cite schtools publications, use: Sovacool K, Lesniak N, Schloss P (2022). schtools: Schloss Lab Tools Reproducible Microbiome Research. http://www.schlosslab.org/schtools/, https://github.com/SchlossLab/schtools. BibTeX entry LaTeX users :","code":"@Manual{, title = {schtools: Schloss Lab Tools for Reproducible Microbiome Research}, author = {Kelly Sovacool and Nick Lesniak and Patrick Schloss}, year = {2022}, note = {http://www.schlosslab.org/schtools/, https://github.com/SchlossLab/schtools}, }"},{"path":"http://www.schlosslab.org/schtools/dev/pull_request_template.html","id":"issues","dir":"","previous_headings":"","what":"Issues","title":"NA","text":"Resolves # .","code":""},{"path":[]},{"path":"http://www.schlosslab.org/schtools/dev/pull_request_template.html","id":"checklist","dir":"","previous_headings":"","what":"Checklist","title":"NA","text":"(Strikethrough points applicable.) Write unit tests new functionality. Update roxygen comments & vignettes API changes. Update NEWS.md includes user-facing changes. check workflow succeeds recent commit.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/calc_relabun.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate OTU relative abundances from a shared file — calc_relabun","title":"Calculate OTU relative abundances from a shared file — calc_relabun","text":"Calculate OTU relative abundances shared file","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/calc_relabun.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate OTU relative abundances from a shared file — calc_relabun","text":"","code":"calc_relabun(abs_abun_dat)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/calc_relabun.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate OTU relative abundances from a shared file — calc_relabun","text":"abs_abun_dat data frame reading shared file. contain Group column sample names, Otu columns absolute counts OTU, rows sample.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/calc_relabun.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculate OTU relative abundances from a shared file — calc_relabun","text":"new data frame OTU relative abundances long format.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/calc_relabun.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Calculate OTU relative abundances from a shared file — calc_relabun","text":"Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/calc_relabun.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Calculate OTU relative abundances from a shared file — calc_relabun","text":"","code":"shared_dat <- readr::read_tsv(system.file(\"extdata\", \"test.shared\", package = \"schtools\")) #> Rows: 10 Columns: 15 #> ── Column specification ──────────────────────────────────────────────────────── #> Delimiter: \"\\t\" #> chr (1): Group #> dbl (14): label, numOtus, Otu0001, Otu0003, Otu0004, Otu00008, Otu0044, Otu0... #> #> ℹ Use `spec()` to retrieve the full column specification for this data. #> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message. shared_dat %>% calc_relabun() #> # A tibble: 120 × 3 #> sample otu rel_abun #> #> 1 p1 Otu0001 0 #> 2 p1 Otu0003 0 #> 3 p1 Otu0004 0 #> 4 p1 Otu00008 0 #> 5 p1 Otu0044 0.25 #> 6 p1 Otu0056 0.25 #> 7 p1 Otu0057 0 #> 8 p1 Otu0058 0.25 #> 9 p1 Otu0159 0 #> 10 p1 Otu0208 0.25 #> # … with 110 more rows"},{"path":"http://www.schlosslab.org/schtools/dev/reference/close_enough.html","id":null,"dir":"Reference","previous_headings":"","what":"Check whether two numeric vectors are close enough for gov't work. — close_enough","title":"Check whether two numeric vectors are close enough for gov't work. — close_enough","text":"like dplyr::near() except much less precision.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/close_enough.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check whether two numeric vectors are close enough for gov't work. — close_enough","text":"","code":"close_enough(x, y, tol = 10^-3)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/close_enough.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check whether two numeric vectors are close enough for gov't work. — close_enough","text":"x numeric vector y another numeric vector tol tolerance (default: 10^-3.)","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/close_enough.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check whether two numeric vectors are close enough for gov't work. — close_enough","text":"TRUE numbers near enough within tolerance, otherwise FALSE","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/close_enough.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Check whether two numeric vectors are close enough for gov't work. — close_enough","text":"Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/close_enough.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check whether two numeric vectors are close enough for gov't work. — close_enough","text":"","code":"close_enough(0.0004, 0) #> [1] TRUE close_enough(0.8887, 0.8884) #> [1] TRUE close_enough(1, 2) #> [1] FALSE"},{"path":"http://www.schlosslab.org/schtools/dev/reference/format_number.html","id":null,"dir":"Reference","previous_headings":"","what":"Format human-readable numbers. — format_number","title":"Format human-readable numbers. — format_number","text":"Pastes formatted x numeric, otherwise x unmodified. Circumvents R's automatic scientific notation. number nearly whole (see is_nearly_whole()), rounded zero decimal places. Otherwise, numbers >= 1 rounded 1 decimal place; numbers < 1 rounded 2 significant digits.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/format_number.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format human-readable numbers. — format_number","text":"","code":"format_number(x, nsmall = 1, signif_precise = 2)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/format_number.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format human-readable numbers. — format_number","text":"x inline code nsmall number digits decimal point round x nearly whole x >= 1. signif_precise number significant digits use x nearly whole","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/format_number.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Format human-readable numbers. — format_number","text":"formatted x numeric, otherwise x unmodified.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/format_number.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Format human-readable numbers. — format_number","text":"Pat Schloss pschloss@umich.edu Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/format_number.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Format human-readable numbers. — format_number","text":"","code":"format_number(0.0256) #> [1] \"0.026\" format_number(.Machine$double.eps^0.5) #> [1] \"0.000000015\" format_number(100000.08) #> [1] \"100,000.1\" format_number(1.00000000000000000001) #> [1] \"1\" format_number(\"this is a string\") #> [1] \"this is a string\""},{"path":"http://www.schlosslab.org/schtools/dev/reference/inline_hook.html","id":null,"dir":"Reference","previous_headings":"","what":"Inline hook for knitr to paste human-readable numbers and nice lists. — inline_hook","title":"Inline hook for knitr to paste human-readable numbers and nice lists. — inline_hook","text":"Inline hook knitr paste human-readable numbers nice lists.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/inline_hook.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Inline hook for knitr to paste human-readable numbers and nice lists. — inline_hook","text":"","code":"inline_hook(x)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/inline_hook.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Inline hook for knitr to paste human-readable numbers and nice lists. — inline_hook","text":"x just anything","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/inline_hook.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Inline hook for knitr to paste human-readable numbers and nice lists. — inline_hook","text":"string element x separated comma numbers human-readable format.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/inline_hook.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Inline hook for knitr to paste human-readable numbers and nice lists. — inline_hook","text":"Kelly Sovacool sovacool@umich.edu Pat Schloss pschloss@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/inline_hook.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Inline hook for knitr to paste human-readable numbers and nice lists. — inline_hook","text":"","code":"inline_hook(c(1.2993992, 0.03, 1000)) #> [1] \"1.3, 0.03, and 1,000\" inline_hook(c(\"cats\", \"dogs\")) #> [1] \"cats and dogs\""},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nearly_whole.html","id":null,"dir":"Reference","previous_headings":"","what":"Checks whether a number is near to a whole number — is_nearly_whole","title":"Checks whether a number is near to a whole number — is_nearly_whole","text":"Checks whether number near whole number","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nearly_whole.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Checks whether a number is near to a whole number — is_nearly_whole","text":"","code":"is_nearly_whole(x)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nearly_whole.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Checks whether a number is near to a whole number — is_nearly_whole","text":"x numeric","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nearly_whole.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Checks whether a number is near to a whole number — is_nearly_whole","text":"TRUE FALSE","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nearly_whole.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Checks whether a number is near to a whole number — is_nearly_whole","text":"Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nearly_whole.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Checks whether a number is near to a whole number — is_nearly_whole","text":"","code":"is_nearly_whole(.Machine$double.eps^0.5) #> [1] FALSE is_nearly_whole(.Machine$double.eps^0.6) #> [1] TRUE is_nearly_whole(1) #> [1] TRUE"},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nondesc.html","id":null,"dir":"Reference","previous_headings":"","what":"Check whether all elements given are sorted in non-descending order — is_nondesc","title":"Check whether all elements given are sorted in non-descending order — is_nondesc","text":"Check whether elements given sorted non-descending order","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nondesc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check whether all elements given are sorted in non-descending order — is_nondesc","text":"","code":"is_nondesc(...)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nondesc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check whether all elements given are sorted in non-descending order — is_nondesc","text":"... anything!","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nondesc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check whether all elements given are sorted in non-descending order — is_nondesc","text":"TRUE elements sorted non-descending order, otherwise FALSE","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nondesc.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Check whether all elements given are sorted in non-descending order — is_nondesc","text":"Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nondesc.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check whether all elements given are sorted in non-descending order — is_nondesc","text":"","code":"is_nondesc(1, 2, 3) #> [1] TRUE is_nondesc(c(1, 2), 3) #> [1] TRUE is_nondesc(6, 4, 1) #> [1] FALSE is_nondesc(\"a\", \"b\", \"c\") #> [1] TRUE is_nondesc(c(\"z\", \"y\")) #> [1] FALSE"},{"path":"http://www.schlosslab.org/schtools/dev/reference/load_deps.html","id":null,"dir":"Reference","previous_headings":"","what":"Install & load packages — load_deps","title":"Install & load packages — load_deps","text":"Install & load packages","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/load_deps.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Install & load packages — load_deps","text":"","code":"load_deps(...)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/load_deps.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Install & load packages — load_deps","text":"... package names install & load","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/load_deps.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Install & load packages — load_deps","text":"Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/log_snakemake.html","id":null,"dir":"Reference","previous_headings":"","what":"Save output, messages, warnings, and errors to the Snakemake log file — log_snakemake","title":"Save output, messages, warnings, and errors to the Snakemake log file — log_snakemake","text":"function checks whether log file specified Snakemake rule. , directs output, messages, warnings, errors rule-specific log file. See Snakemake documentation log files R scripts details.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/log_snakemake.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Save output, messages, warnings, and errors to the Snakemake log file — log_snakemake","text":"","code":"log_snakemake(quiet = TRUE)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/log_snakemake.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Save output, messages, warnings, and errors to the Snakemake log file — log_snakemake","text":"quiet Silence messages status snakemake object log file (default: TRUE).","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/log_snakemake.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Save output, messages, warnings, and errors to the Snakemake log file — log_snakemake","text":"Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/log_snakemake.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Save output, messages, warnings, and errors to the Snakemake log file — log_snakemake","text":"","code":"# The Snakemake object doesn't exist, so nothing happens log_snakemake(quiet = FALSE) #> No Snakemake object exists, so all output will print as usual"},{"path":"http://www.schlosslab.org/schtools/dev/reference/parse_tax.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert taxonomy strings into dataframe of labels based on taxonomic classification — parse_tax","title":"Convert taxonomy strings into dataframe of labels based on taxonomic classification — parse_tax","text":"Convert taxonomy strings dataframe labels based taxonomic classification","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/parse_tax.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert taxonomy strings into dataframe of labels based on taxonomic classification — parse_tax","text":"","code":"parse_tax(dat)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/parse_tax.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert taxonomy strings into dataframe of labels based on taxonomic classification — parse_tax","text":"dat dataframe mothur taxonomy file columns OTU, Size, Taxonomy","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/parse_tax.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert taxonomy strings into dataframe of labels based on taxonomic classification — parse_tax","text":"wide dataframe taxonomic labels","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/parse_tax.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Convert taxonomy strings into dataframe of labels based on taxonomic classification — parse_tax","text":"Nick Lesniak, nlesniak@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/parse_tax.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert taxonomy strings into dataframe of labels based on taxonomic classification — parse_tax","text":"","code":"taxonomy_filepath <- system.file(\"extdata\", \"test.taxonomy\", package = \"schtools\" ) taxonomy_tbl <- read_tax(taxonomy_filepath) head(taxonomy_tbl) #> # A tibble: 6 × 10 #> otu otu_label tax_otu_l…¹ label…² kingdom phylum class order family genus #> #> 1 Otu0001 OTU 1 Bacteroide… Bac… Bacter… Bacte… Bact… Bact… Bacte… Bact… #> 2 Otu0003 OTU 3 Porphyromo… Por… Bacter… Bacte… Bact… Bact… Porph… Porp… #> 3 Otu0004 OTU 4 Porphyromo… Por… Bacter… Bacte… Bact… Bact… Porph… Porp… #> 4 Otu00008 OTU 8 Enterobact… Ent… Bacter… Prote… Gamm… Ente… Enter… Ente… #> 5 Otu0044 OTU 44 Bacteria (… Bac… Bacter… Bacte… Bact… Bact… Bacte… Bact… #> 6 Otu0056 OTU 56 Bacteria (… Bac… Bacter… Bacte… Bact… Bact… Bacte… Bact… #> # … with abbreviated variable names ¹​tax_otu_label, ²​label_html"},{"path":"http://www.schlosslab.org/schtools/dev/reference/paste_oxford_list.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a prose string from a list or vector — paste_oxford_list","title":"Create a prose string from a list or vector — paste_oxford_list","text":"word '' inserted last element Oxford comma used.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/paste_oxford_list.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a prose string from a list or vector — paste_oxford_list","text":"","code":"paste_oxford_list(x)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/paste_oxford_list.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a prose string from a list or vector — paste_oxford_list","text":"x list vector","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/paste_oxford_list.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a prose string from a list or vector — paste_oxford_list","text":"string element x separated comma","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/paste_oxford_list.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Create a prose string from a list or vector — paste_oxford_list","text":"Pat Schloss pschloss@umich.edu Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/paste_oxford_list.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a prose string from a list or vector — paste_oxford_list","text":"","code":"paste_oxford_list(1:3) #> [1] \"1, 2, and 3\" paste_oxford_list(c(\"cats\", \"dogs\", \"turtles\")) #> [1] \"cats, dogs, and turtles\""},{"path":"http://www.schlosslab.org/schtools/dev/reference/pool_taxon_counts.html","id":null,"dir":"Reference","previous_headings":"","what":"Pool OTU counts at a particular taxonomic level — pool_taxon_counts","title":"Pool OTU counts at a particular taxonomic level — pool_taxon_counts","text":"Enables comparing analyses different taxonomic resolutions, seen https://doi.org/10.1128/mbio.03161-21. Implementation adapted .","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/pool_taxon_counts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pool OTU counts at a particular taxonomic level — pool_taxon_counts","text":"","code":"pool_taxon_counts(otu_shared_dat, otu_tax_dat, taxon_level)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/pool_taxon_counts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pool OTU counts at a particular taxonomic level — pool_taxon_counts","text":"otu_shared_dat data frame created shared file OTU level. otu_tax_dat data frame created taxonomy file OTU level. Must dataset shared file. taxon_level taxonomic level pool OTUs (kingdom, phylum, class, order, family, genus). column otu_tax_dat.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/pool_taxon_counts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pool OTU counts at a particular taxonomic level — pool_taxon_counts","text":"shared data frame OTUs specified taxon_level corresponding taxonomy dataframe new OTU numbers.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/pool_taxon_counts.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Pool OTU counts at a particular taxonomic level — pool_taxon_counts","text":"Kelly Sovacool, sovacool@umich.edu Pat Schloss pschloss@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/pool_taxon_counts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Pool OTU counts at a particular taxonomic level — pool_taxon_counts","text":"","code":"tax_dat <- read_tax(system.file(\"extdata\", \"test.taxonomy\", package = \"schtools\" )) shared_dat <- readr::read_tsv(system.file(\"extdata\", \"test.shared\", package = \"schtools\" )) #> Rows: 10 Columns: 15 #> ── Column specification ──────────────────────────────────────────────────────── #> Delimiter: \"\\t\" #> chr (1): Group #> dbl (14): label, numOtus, Otu0001, Otu0003, Otu0004, Otu00008, Otu0044, Otu0... #> #> ℹ Use `spec()` to retrieve the full column specification for this data. #> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message. pool_taxon_counts(shared_dat, tax_dat, genus) #> $shared #> # A tibble: 10 × 13 #> label Group numOtus Otu01 Otu02 Otu03 Otu04 Otu05 Otu06 Otu07 Otu08 Otu09 #> #> 1 genus p1 10 0 0 0 2 0 1 0 1 0 #> 2 genus p10 10 1 0 1 0 1 0 1 1 1 #> 3 genus p2 10 1 1 0 1 0 1 0 0 1 #> 4 genus p3 10 0 1 0 1 0 0 1 0 1 #> 5 genus p4 10 1 1 1 0 0 0 0 0 0 #> 6 genus p5 10 1 1 0 1 0 0 0 0 1 #> 7 genus p6 10 1 0 1 1 1 1 0 0 1 #> 8 genus p7 10 0 0 0 1 1 0 1 0 1 #> 9 genus p8 10 0 1 1 2 0 0 1 1 0 #> 10 genus p9 10 0 1 1 2 0 0 1 1 1 #> # … with 1 more variable: Otu10 #> #> $tax #> # A tibble: 10 × 3 #> otu size genus #> #> 1 Otu01 5 Bacteroides #> 2 Otu02 6 Porphyromonadaceae unclassified #> 3 Otu03 5 Enterobacteriaceae unclassified #> 4 Otu04 11 Bacteria unclassified #> 5 Otu05 3 Acinetobacter #> 6 Otu06 3 Clostridium XlVa #> 7 Otu07 5 Betaproteobacteria unclassified #> 8 Otu08 4 Clostridium XVIII #> 9 Otu09 7 Candidatus Saccharibacteria unclassified #> 10 Otu10 5 Clostridiales Incertae Sedis XIII unclassified #> pool_taxon_counts(shared_dat, tax_dat, family) #> $shared #> # A tibble: 10 × 13 #> label Group numOtus Otu01 Otu02 Otu03 Otu04 Otu05 Otu06 Otu07 Otu08 Otu09 #> #> 1 family p1 10 0 0 0 2 0 1 0 1 0 #> 2 family p10 10 1 0 1 0 1 0 1 1 1 #> 3 family p2 10 1 1 0 1 0 1 0 0 1 #> 4 family p3 10 0 1 0 1 0 0 1 0 1 #> 5 family p4 10 1 1 1 0 0 0 0 0 0 #> 6 family p5 10 1 1 0 1 0 0 0 0 1 #> 7 family p6 10 1 0 1 1 1 1 0 0 1 #> 8 family p7 10 0 0 0 1 1 0 1 0 1 #> 9 family p8 10 0 1 1 2 0 0 1 1 0 #> 10 family p9 10 0 1 1 2 0 0 1 1 1 #> # … with 1 more variable: Otu10 #> #> $tax #> # A tibble: 10 × 3 #> otu size family #> #> 1 Otu01 5 Bacteroidaceae #> 2 Otu02 6 Porphyromonadaceae #> 3 Otu03 5 Enterobacteriaceae #> 4 Otu04 11 Bacteria unclassified #> 5 Otu05 3 Moraxellaceae #> 6 Otu06 3 Lachnospiraceae #> 7 Otu07 5 Betaproteobacteria unclassified #> 8 Otu08 4 Erysipelotrichaceae #> 9 Otu09 7 Candidatus Saccharibacteria unclassified #> 10 Otu10 5 Clostridiales Incertae Sedis XIII #> pool_taxon_counts(shared_dat, tax_dat, phylum) #> $shared #> # A tibble: 10 × 8 #> label Group numOtus Otu1 Otu2 Otu3 Otu4 Otu5 #> #> 1 phylum p1 5 0 0 2 2 0 #> 2 phylum p10 5 1 3 0 1 1 #> 3 phylum p2 5 2 0 1 2 1 #> 4 phylum p3 5 1 1 1 1 1 #> 5 phylum p4 5 2 1 0 1 0 #> 6 phylum p5 5 2 0 1 0 1 #> 7 phylum p6 5 1 2 1 1 1 #> 8 phylum p7 5 0 2 1 1 1 #> 9 phylum p8 5 1 2 2 1 0 #> 10 phylum p9 5 1 2 2 2 1 #> #> $tax #> # A tibble: 5 × 3 #> otu size phylum #> #> 1 Otu1 11 Bacteroidetes #> 2 Otu2 13 Proteobacteria #> 3 Otu3 11 Bacteria unclassified #> 4 Otu4 12 Firmicutes #> 5 Otu5 7 Candidatus Saccharibacteria #>"},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_dist.html","id":null,"dir":"Reference","previous_headings":"","what":"Read in lower left triangular matrix from file — read_dist","title":"Read in lower left triangular matrix from file — read_dist","text":"Read lower left triangular matrix file","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_dist.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read in lower left triangular matrix from file — read_dist","text":"","code":"read_dist(dist_filename)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_dist.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read in lower left triangular matrix from file — read_dist","text":"dist_filename filename lower left triangular matrix (.dist)","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_dist.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read in lower left triangular matrix from file — read_dist","text":"distance matrix tibble","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_dist.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Read in lower left triangular matrix from file — read_dist","text":"Nick Lesniak, nlesniak@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_dist.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read in lower left triangular matrix from file — read_dist","text":"","code":"dist_filepath <- system.file(\"extdata\", \"sample.final.thetayc.0.03.lt.ave.dist\", package = \"schtools\" ) dist_tbl <- read_dist(dist_filepath) head(dist_tbl) #> # A tibble: 6 × 3 #> rows columns distances #> #> 1 104_1_D1 104_1_D0 0.893 #> 2 104_1_D10 104_1_D0 0.254 #> 3 104_1_D10 104_1_D1 0.922 #> 4 104_1_D2 104_1_D0 0.874 #> 5 104_1_D2 104_1_D1 0.109 #> 6 104_1_D2 104_1_D10 0.904"},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_tax.html","id":null,"dir":"Reference","previous_headings":"","what":"Read in a taxonomy file and parse it to a wide dataframe — read_tax","title":"Read in a taxonomy file and parse it to a wide dataframe — read_tax","text":"Read taxonomy file parse wide dataframe","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_tax.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read in a taxonomy file and parse it to a wide dataframe — read_tax","text":"","code":"read_tax(taxonomy_filename, sep = \"\\t\")"},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_tax.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read in a taxonomy file and parse it to a wide dataframe — read_tax","text":"taxonomy_filename filename taxonomy file sep Character separates fields taxonomy file. (Default: \\t).","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_tax.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read in a taxonomy file and parse it to a wide dataframe — read_tax","text":"dataframe taxonomic labels, formatted parse_tax()","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_tax.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Read in a taxonomy file and parse it to a wide dataframe — read_tax","text":"Nick Lesniak, nlesniak@umich.edu Kelly Sovacool, sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_tax.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read in a taxonomy file and parse it to a wide dataframe — read_tax","text":"","code":"taxonomy_filepath <- system.file(\"extdata\", \"test.taxonomy\", package = \"schtools\" ) taxonomy_tbl <- read_tax(taxonomy_filepath) head(taxonomy_tbl) #> # A tibble: 6 × 10 #> otu otu_label tax_otu_l…¹ label…² kingdom phylum class order family genus #> #> 1 Otu0001 OTU 1 Bacteroide… Bac… Bacter… Bacte… Bact… Bact… Bacte… Bact… #> 2 Otu0003 OTU 3 Porphyromo… Por… Bacter… Bacte… Bact… Bact… Porph… Porp… #> 3 Otu0004 OTU 4 Porphyromo… Por… Bacter… Bacte… Bact… Bact… Porph… Porp… #> 4 Otu00008 OTU 8 Enterobact… Ent… Bacter… Prote… Gamm… Ente… Enter… Ente… #> 5 Otu0044 OTU 44 Bacteria (… Bac… Bacter… Bacte… Bact… Bact… Bacte… Bact… #> 6 Otu0056 OTU 56 Bacteria (… Bac… Bacter… Bacte… Bact… Bact… Bacte… Bact… #> # … with abbreviated variable names ¹​tax_otu_label, ²​label_html"},{"path":"http://www.schlosslab.org/schtools/dev/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"dplyr pipe — reexports","title":"dplyr pipe — reexports","text":"objects imported packages. Follow links see documentation. dplyr %>% rlang .data","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/schtools.html","id":null,"dir":"Reference","previous_headings":"","what":"schtools: Schloss Lab Tools for Reproducible Microbiome Research — schtools","title":"schtools: Schloss Lab Tools for Reproducible Microbiome Research — schtools","text":"collection useful functions example code created used Schloss Lab reproducible microbiome research. Perform common tasks like read files created mothur, tidy microbiome data, format rmarkdown documents publication. See website information, documentation, examples.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/set_knitr_opts.html","id":null,"dir":"Reference","previous_headings":"","what":"Set knitr chunk options & inline hook — set_knitr_opts","title":"Set knitr chunk options & inline hook — set_knitr_opts","text":"Call function setup chunk R Markdown files.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/set_knitr_opts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set knitr chunk options & inline hook — set_knitr_opts","text":"","code":"set_knitr_opts()"},{"path":"http://www.schlosslab.org/schtools/dev/reference/set_knitr_opts.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Set knitr chunk options & inline hook — set_knitr_opts","text":"Pat Schloss pschloss@umich.edu Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/news/index.html","id":"schtools-021","dir":"Changelog","previous_headings":"","what":"schtools 0.2.1","title":"schtools 0.2.1","text":"CRAN release: 2022-05-11 New column label_html provides HTML correctly italicize genus names OTU labels. Added example intro vignette demonstrate using feature ggtext. Changed taxonomy data frame column names lowercase reordered . Minor documentation improvements (#33, @kelly-sovacool).","code":""},{"path":"http://www.schlosslab.org/schtools/dev/news/index.html","id":"schtools-011","dir":"Changelog","previous_headings":"","what":"schtools 0.1.1","title":"schtools 0.1.1","text":"CRAN release: 2022-03-11 New function parse_tax() separate logic reading parsing taxonomy files. read_tax() now accepts sep parameter handle different delim file types (e.g. csv tsv). schtools now logo! (#31, @kelly-sovacool)","code":""},{"path":"http://www.schlosslab.org/schtools/dev/news/index.html","id":"schtools-010","dir":"Changelog","previous_headings":"","what":"schtools 0.1.0","title":"schtools 0.1.0","text":"CRAN release: 2021-11-22 first release version schtools! 🎉 can now install schtools CRAN! Added NEWS.md file track changes package. read_dist() (#10, @NLesniak) read_tax() (#22, @NLesniak) set_knitr_opts() (#21, @pschloss, @kelly-sovacool) inline_hook() (#21, @pschloss, @kelly-sovacool) paste_oxford_list() (#21, @pschloss, @kelly-sovacool) format_number() (#24, @pschloss, @kelly-sovacool) is_nearly_whole() (#24, @pschloss, @kelly-sovacool) close_enough() (#26, @kelly-sovacool) is_nondesc() (#28, @kelly-sovacool) introduction","code":""}] +[{"path":[]},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"our-pledge","dir":"","previous_headings":"","what":"Our Pledge","title":"Contributor Covenant Code of Conduct","text":"members, contributors, leaders pledge make participation community harassment-free experience everyone, regardless age, body size, visible invisible disability, ethnicity, sex characteristics, gender identity expression, level experience, education, socio-economic status, nationality, personal appearance, race, religion, sexual identity orientation. pledge act interact ways contribute open, welcoming, diverse, inclusive, healthy community.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"our-standards","dir":"","previous_headings":"","what":"Our Standards","title":"Contributor Covenant Code of Conduct","text":"Examples behavior contributes positive environment community include: Demonstrating empathy kindness toward people respectful differing opinions, viewpoints, experiences Giving gracefully accepting constructive feedback Accepting responsibility apologizing affected mistakes, learning experience Focusing best just us individuals, overall community Examples unacceptable behavior include: use sexualized language imagery, sexual attention advances kind Trolling, insulting derogatory comments, personal political attacks Public private harassment Publishing others’ private information, physical email address, without explicit permission conduct reasonably considered inappropriate professional setting","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"enforcement-responsibilities","dir":"","previous_headings":"","what":"Enforcement Responsibilities","title":"Contributor Covenant Code of Conduct","text":"Community leaders responsible clarifying enforcing standards acceptable behavior take appropriate fair corrective action response behavior deem inappropriate, threatening, offensive, harmful. Community leaders right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct, communicate reasons moderation decisions appropriate.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"scope","dir":"","previous_headings":"","what":"Scope","title":"Contributor Covenant Code of Conduct","text":"Code Conduct applies within community spaces, also applies individual officially representing community public spaces. Examples representing community include using official e-mail address, posting via official social media account, acting appointed representative online offline event.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"enforcement","dir":"","previous_headings":"","what":"Enforcement","title":"Contributor Covenant Code of Conduct","text":"Instances abusive, harassing, otherwise unacceptable behavior may reported community leaders responsible enforcement [INSERT CONTACT METHOD]. complaints reviewed investigated promptly fairly. community leaders obligated respect privacy security reporter incident.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"enforcement-guidelines","dir":"","previous_headings":"","what":"Enforcement Guidelines","title":"Contributor Covenant Code of Conduct","text":"Community leaders follow Community Impact Guidelines determining consequences action deem violation Code Conduct:","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"1-correction","dir":"","previous_headings":"Enforcement Guidelines","what":"1. Correction","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Use inappropriate language behavior deemed unprofessional unwelcome community. Consequence: private, written warning community leaders, providing clarity around nature violation explanation behavior inappropriate. public apology may requested.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"2-warning","dir":"","previous_headings":"Enforcement Guidelines","what":"2. Warning","title":"Contributor Covenant Code of Conduct","text":"Community Impact: violation single incident series actions. Consequence: warning consequences continued behavior. interaction people involved, including unsolicited interaction enforcing Code Conduct, specified period time. includes avoiding interactions community spaces well external channels like social media. Violating terms may lead temporary permanent ban.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"3-temporary-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"3. Temporary Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: serious violation community standards, including sustained inappropriate behavior. Consequence: temporary ban sort interaction public communication community specified period time. public private interaction people involved, including unsolicited interaction enforcing Code Conduct, allowed period. Violating terms may lead permanent ban.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"4-permanent-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"4. Permanent Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Demonstrating pattern violation community standards, including sustained inappropriate behavior, harassment individual, aggression toward disparagement classes individuals. Consequence: permanent ban sort public interaction within community.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CODE_OF_CONDUCT.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Contributor Covenant Code of Conduct","text":"Code Conduct adapted Contributor Covenant, version 2.0, available https://www.contributor-covenant.org/version/2/0/ code_of_conduct.html. Community Impact Guidelines inspired Mozilla’s code conduct enforcement ladder. answers common questions code conduct, see FAQ https://www.contributor-covenant.org/faq. Translations available https:// www.contributor-covenant.org/translations.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to schtools","title":"Contributing to schtools","text":"outlines propose change schtools. detailed info contributing , tidyverse packages, please see development contributing guide.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to schtools","text":"can fix typos, spelling mistakes, grammatical errors documentation directly using GitHub web interface, long changes made source file. generally means ’ll need edit roxygen2 comments .R, .Rd file. can find .R file generates .Rd reading comment first line.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CONTRIBUTING.html","id":"bigger-changes","dir":"","previous_headings":"","what":"Bigger changes","title":"Contributing to schtools","text":"want make bigger change, ’s good idea first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed).","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Bigger changes","what":"Pull request process","title":"Contributing to schtools","text":"Fork package clone onto computer. haven’t done , recommend using usethis::create_from_github(\"SchlossLab/schtools\", fork = TRUE). Install development dependences devtools::install_dev_deps(), make sure package passes R CMD check running devtools::check(). R CMD check doesn’t pass cleanly, ’s good idea ask help continuing. Create Git branch pull request (PR). recommend using usethis::pr_init(\"brief-description--change\"). Make changes, commit git, create PR running usethis::pr_push(), following prompts browser. title PR briefly describe change. body PR contain Fixes #issue-number. user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Bigger changes","what":"Code style","title":"Contributing to schtools","text":"New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat unit tests. Contributions test cases included easier accept.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to schtools","text":"Please note schtools project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"License","title":"License","text":"software licensed MIT License. Everything else licensed CC -SA license.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/LICENSE.html","id":"mit-license","dir":"","previous_headings":"","what":"MIT License","title":"License","text":"Copyright (c) 2021 Kelly L. Sovacool, Nick Lesniak, Patrick D. Schloss Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/LICENSE.html","id":"creative-commons-share-alike-license","dir":"","previous_headings":"","what":"Creative Commons Share Alike License","title":"License","text":"schtools logo licensed CC -SA 4.0 license. hammer poo images contained logo designed OpenMoji, open-source emoji icon project, also licensed CC -SA 4.0.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/SUPPORT.html","id":null,"dir":"","previous_headings":"","what":"Getting help with schtools","title":"Getting help with schtools","text":"Thanks using schtools! filing issue, places explore pieces put together make process smooth possible.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/SUPPORT.html","id":"make-a-reprex","dir":"","previous_headings":"","what":"Make a reprex","title":"Getting help with schtools","text":"Start making minimal reproducible example using reprex package. haven’t heard used reprex , ’re treat! Seriously, reprex make R-question-asking endeavors easier (pretty insane ROI five ten minutes ’ll take learn ’s ). additional reprex pointers, check Get help! section tidyverse site.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/SUPPORT.html","id":"where-to-ask","dir":"","previous_headings":"","what":"Where to ask?","title":"Getting help with schtools","text":"Armed reprex, next step figure ask. ’s question: start community.rstudio.com, /StackOverflow. people answer questions. ’s bug: ’re right place, file issue. ’re sure: let community help figure ! problem bug feature request, can easily return report . opening new issue, sure search issues pull requests make sure bug hasn’t reported /already fixed development version. default, search pre-populated :issue :open. can edit qualifiers (e.g. :pr, :closed) needed. example, ’d simply remove :open search issues repo, open closed.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/SUPPORT.html","id":"what-happens-next","dir":"","previous_headings":"","what":"What happens next?","title":"Getting help with schtools","text":"efficient possible, development tidyverse packages tends bursty, shouldn’t worry don’t get immediate response. Typically don’t look repo sufficient quantity issues accumulates, ’s burst intense activity focus efforts. makes development efficient avoids expensive context switching problems, cost taking longer get back . process makes good reprex particularly important might multiple months initial report start working . can’t reproduce bug, can’t fix !","code":""},{"path":[]},{"path":"http://www.schlosslab.org/schtools/dev/articles/introduction.html","id":"calculate-relative-abundances","dir":"Articles","previous_headings":"Handling mothur data","what":"Calculate relative abundances","title":"Introduction to schtools","text":"can read shared file calculate relative abundances calc_relabun(): calc_relabun() returns data frame long format. can use tidyr::pivot_wider() convert wide format: can see relative abundances sample sum 1:","code":"shared_dat <- read_tsv(system.file(\"extdata\", \"test.shared\", package = \"schtools\")) #> Rows: 10 Columns: 15 #> ── Column specification ──────────────────────────────────────────────────────── #> Delimiter: \"\\t\" #> chr (1): Group #> dbl (14): label, numOtus, Otu0001, Otu0003, Otu0004, Otu00008, Otu0044, Otu0... #> #> ℹ Use `spec()` to retrieve the full column specification for this data. #> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message. relabun_dat <- shared_dat %>% calc_relabun() head(relabun_dat) #> # A tibble: 6 × 3 #> sample otu rel_abun #> #> 1 p1 Otu0001 0 #> 2 p1 Otu0003 0 #> 3 p1 Otu0004 0 #> 4 p1 Otu00008 0 #> 5 p1 Otu0044 0.25 #> 6 p1 Otu0056 0.25 wide_dat <- relabun_dat %>% pivot_wider(names_from = \"otu\", values_from = \"rel_abun\") head(wide_dat) #> # A tibble: 6 × 13 #> sample Otu0001 Otu0003 Otu0004 Otu00…¹ Otu0044 Otu0056 Otu0057 Otu0058 Otu0159 #> #> 1 p1 0 0 0 0 0.25 0.25 0 0.25 0 #> 2 p2 0.167 0 0.167 0 0.167 0 0 0.167 0 #> 3 p3 0 0.2 0 0 0.2 0 0 0 0.2 #> 4 p4 0.25 0.25 0 0.25 0 0 0 0 0 #> 5 p5 0.25 0 0.25 0 0.25 0 0 0 0 #> 6 p6 0.167 0 0 0.167 0 0.167 0.167 0.167 0 #> # … with 3 more variables: Otu0208 , Otu0328 , Otu0329 , and #> # abbreviated variable name ¹​Otu00008 wide_dat %>% select(starts_with(\"Otu\")) %>% rowSums() #> [1] 1 1 1 1 1 1 1 1 1 1"},{"path":"http://www.schlosslab.org/schtools/dev/articles/introduction.html","id":"taxonomy-files","dir":"Articles","previous_headings":"Handling mothur data","what":"Taxonomy files","title":"Introduction to schtools","text":"mothur formats taxonomy files tab-separated values (tsv). can use read_tax() parse taxonomy data create separate columns taxonomic level. column label_html provides html correctly italicizes genus name without italicizing OTU label. can used ggtext::element_markdown() make nice plots:","code":"tax_dat <- read_tax(system.file(\"extdata\", \"test.taxonomy\", package = \"schtools\")) head(tax_dat) #> # A tibble: 6 × 10 #> otu otu_label tax_otu_l…¹ label…² kingdom phylum class order family genus #> #> 1 Otu0001 OTU 1 Bacteroide… Bac… Bacter… Bacte… Bact… Bact… Bacte… Bact… #> 2 Otu0003 OTU 3 Porphyromo… Por… Bacter… Bacte… Bact… Bact… Porph… Porp… #> 3 Otu0004 OTU 4 Porphyromo… Por… Bacter… Bacte… Bact… Bact… Porph… Porp… #> 4 Otu00008 OTU 8 Enterobact… Ent… Bacter… Prote… Gamm… Ente… Enter… Ente… #> 5 Otu0044 OTU 44 Bacteria (… Bac… Bacter… Bacte… Bact… Bact… Bacte… Bact… #> 6 Otu0056 OTU 56 Bacteria (… Bac… Bacter… Bacte… Bact… Bact… Bacte… Bact… #> # … with abbreviated variable names ¹​tax_otu_label, ²​label_html library(ggtext) set.seed(20220427) relabun_dat %>% mutate(sample_num = stringr::str_remove(sample, \"p\") %>% as.integer(), treatment = case_when(sample_num%%2 == 1 ~ \"A\", TRUE ~ \"B\")) %>% inner_join(tax_dat, by = \"otu\") %>% ggplot(aes(x = rel_abun, y = label_html, color = treatment)) + geom_jitter(alpha = 0.7, height = 0.2) + labs(x = \"Relative abundance\", y = \"\") + theme_minimal() + theme(axis.text.y = element_markdown())"},{"path":"http://www.schlosslab.org/schtools/dev/articles/introduction.html","id":"pooling-otu-counts-at-different-taxonomic-levels","dir":"Articles","previous_headings":"Handling mothur data > Taxonomy files","what":"Pooling OTU counts at different taxonomic levels","title":"Introduction to schtools","text":"common task repeat OTU-level analyses different taxonomic levels determine resolution optimal answering questions. ’ll need shared file, generated clustering sequences OTUs mothur, corresponding taxonomy file. Take look mothur documentation info generating files performing microbiome analyses. example, pool_taxon_counts() pools OTU counts shared file genus level returns new shared taxonomy data frames. can taxonomic level taxonomy data frame.","code":"tax_dat <- read_tax(system.file(\"extdata\", \"test.taxonomy\", package = \"schtools\")) shared_dat <- readr::read_tsv(system.file(\"extdata\", \"test.shared\", package = \"schtools\")) #> Rows: 10 Columns: 15 #> ── Column specification ──────────────────────────────────────────────────────── #> Delimiter: \"\\t\" #> chr (1): Group #> dbl (14): label, numOtus, Otu0001, Otu0003, Otu0004, Otu00008, Otu0044, Otu0... #> #> ℹ Use `spec()` to retrieve the full column specification for this data. #> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message. pool_taxon_counts(shared_dat, tax_dat, genus) #> $shared #> # A tibble: 10 × 13 #> label Group numOtus Otu01 Otu02 Otu03 Otu04 Otu05 Otu06 Otu07 Otu08 Otu09 #> #> 1 genus p1 10 0 0 0 2 0 1 0 1 0 #> 2 genus p10 10 1 0 1 0 1 0 1 1 1 #> 3 genus p2 10 1 1 0 1 0 1 0 0 1 #> 4 genus p3 10 0 1 0 1 0 0 1 0 1 #> 5 genus p4 10 1 1 1 0 0 0 0 0 0 #> 6 genus p5 10 1 1 0 1 0 0 0 0 1 #> 7 genus p6 10 1 0 1 1 1 1 0 0 1 #> 8 genus p7 10 0 0 0 1 1 0 1 0 1 #> 9 genus p8 10 0 1 1 2 0 0 1 1 0 #> 10 genus p9 10 0 1 1 2 0 0 1 1 1 #> # … with 1 more variable: Otu10 #> #> $tax #> # A tibble: 10 × 3 #> otu size genus #> #> 1 Otu01 5 Bacteroides #> 2 Otu02 6 Porphyromonadaceae unclassified #> 3 Otu03 5 Enterobacteriaceae unclassified #> 4 Otu04 11 Bacteria unclassified #> 5 Otu05 3 Acinetobacter #> 6 Otu06 3 Clostridium XlVa #> 7 Otu07 5 Betaproteobacteria unclassified #> 8 Otu08 4 Clostridium XVIII #> 9 Otu09 7 Candidatus Saccharibacteria unclassified #> 10 Otu10 5 Clostridiales Incertae Sedis XIII unclassified pool_taxon_counts(shared_dat, tax_dat, phylum) #> $shared #> # A tibble: 10 × 8 #> label Group numOtus Otu1 Otu2 Otu3 Otu4 Otu5 #> #> 1 phylum p1 5 0 0 2 2 0 #> 2 phylum p10 5 1 3 0 1 1 #> 3 phylum p2 5 2 0 1 2 1 #> 4 phylum p3 5 1 1 1 1 1 #> 5 phylum p4 5 2 1 0 1 0 #> 6 phylum p5 5 2 0 1 0 1 #> 7 phylum p6 5 1 2 1 1 1 #> 8 phylum p7 5 0 2 1 1 1 #> 9 phylum p8 5 1 2 2 1 0 #> 10 phylum p9 5 1 2 2 2 1 #> #> $tax #> # A tibble: 5 × 3 #> otu size phylum #> #> 1 Otu1 11 Bacteroidetes #> 2 Otu2 13 Proteobacteria #> 3 Otu3 11 Bacteria unclassified #> 4 Otu4 12 Firmicutes #> 5 Otu5 7 Candidatus Saccharibacteria"},{"path":"http://www.schlosslab.org/schtools/dev/articles/introduction.html","id":"distance-files","dir":"Articles","previous_headings":"Handling mothur data","what":"Distance files","title":"Introduction to schtools","text":"distance file saved phylip-formatted lower triangle matrix mothur’s dist.seqs command, can read R read_dist():","code":"dist_filepath <- system.file(\"extdata\", \"sample.final.thetayc.0.03.lt.ave.dist\", package = \"schtools\") dist_tbl <- read_dist(dist_filepath) head(dist_tbl) #> # A tibble: 6 × 3 #> rows columns distances #> #> 1 104_1_D1 104_1_D0 0.893 #> 2 104_1_D10 104_1_D0 0.254 #> 3 104_1_D10 104_1_D1 0.922 #> 4 104_1_D2 104_1_D0 0.874 #> 5 104_1_D2 104_1_D1 0.109 #> 6 104_1_D2 104_1_D10 0.904"},{"path":"http://www.schlosslab.org/schtools/dev/articles/introduction.html","id":"r-markdown-helpers-for-scientific-writing","dir":"Articles","previous_headings":"","what":"R Markdown helpers for scientific writing","title":"Introduction to schtools","text":"writing scientific papers R Markdown, often find using knitr chunk options miscellaneous helper functions. use favorite options like eval=TRUE, echo=FALSE, others, run set_knitr_opts() first chunk R Markdown document: also sets inline hook custom inline_hook() function, automatically formats numbers human-readable way inserts Oxford comma lists needed.","code":"```{r, include = FALSE} set_knitr_opts() ```"},{"path":"http://www.schlosslab.org/schtools/dev/articles/introduction.html","id":"who-doesnt-love-an-oxford-comma","dir":"Articles","previous_headings":"R Markdown helpers for scientific writing","what":"Who doesn’t love an Oxford comma?","title":"Introduction to schtools","text":"writing R Markdown, may wish insert list vector inline correctly format Oxford comma. inline_hook() uses paste_oxford_list() help just ! Insert string inline code `r `: `r animals` common pets. Rendered output: cats, dogs, fish common pets.","code":"animals <- c(\"cats\", \"dogs\", \"fish\")"},{"path":"http://www.schlosslab.org/schtools/dev/articles/introduction.html","id":"human-readable-numbers","dir":"Articles","previous_headings":"R Markdown helpers for scientific writing","what":"Human-readable numbers","title":"Introduction to schtools","text":"inline_hook() uses format_numbers() hood automatically format numbers human-readable format, rather display scientific notation. numbers `r c(1e-04, 1e-05, 1e-06)` precise, `r c(1e04, 1e05, 1e06)` large. Rendered output: numbers 0.0001, 0.00001, 0.000001 precise. 10,000, 100,000, 1,000,000 large.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/articles/logo.html","id":"emojis","dir":"Articles","previous_headings":"","what":"Emojis","title":"logo","text":"OpenMoji, licensed CC -SA 4.0 poop: https://openmoji.org/library/#search=poo&emoji=1F4A9 wrench: https://openmoji.org/library/#search=tool&emoji=1F527 hammer: https://openmoji.org/library/#search=tool&emoji=1F528","code":"poo_file <- here('vignettes', 'articles','1F4A9_color.png') wrench_file <- here('vignettes', 'articles', '1F527_color.png') hammer_file <- here('vignettes', 'articles', '1F528_color.png') img <- ggdraw() + #draw_image(wrench_file, scale = 0.55, x = 0.195, y = 0.05) + draw_image(hammer_file, scale = 0.7, x = -0.32, y = 0.05) + draw_image(poo_file) ggsave2(img, filename = here('vignettes', 'articles', 'poo-hammer.png'), height = 2, width = 2, units = 'in') img"},{"path":"http://www.schlosslab.org/schtools/dev/articles/logo.html","id":"schtools-logo","dir":"Articles","previous_headings":"","what":"Schtools Logo","title":"logo","text":"","code":"mint <- '#A2EAE0' pink <- '#FA9DC5' orange <- '#FFDBAD' black <- '#000000' logo_filename <- here('vignettes', 'articles', 'schtools-logo.png') sticker(img, package = 'schtools', s_x = 1, s_y = 0.85, s_width = 1.6, s_height = 1.6, p_x = 1, p_y = 1.55, p_color = black, p_size = 23, p_family = 'Source Sans Pro', h_fill = mint, h_color = orange, url = 'schlosslab.org/schtools', u_size = 3.5, filename = logo_filename) ggdraw() + draw_image(logo_filename)"},{"path":"http://www.schlosslab.org/schtools/dev/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Kelly Sovacool. Author, maintainer. Nick Lesniak. Author. Patrick Schloss. Author. Sarah Lucas. Contributor. Courtney Armour. Contributor. Jacqueline Moltzau. Contributor. Andrew Hannah. Contributor. Nielson Baxter. Contributor. Alyxandria Schubert. Contributor. Kathryn Iverson. Contributor.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Sovacool K, Lesniak N, Schloss P (2022). schtools: Schloss Lab Tools Reproducible Microbiome Research. http://www.schlosslab.org/schtools/, https://github.com/SchlossLab/schtools.","code":"@Manual{, title = {schtools: Schloss Lab Tools for Reproducible Microbiome Research}, author = {Kelly Sovacool and Nick Lesniak and Patrick Schloss}, year = {2022}, note = {http://www.schlosslab.org/schtools/, https://github.com/SchlossLab/schtools}, }"},{"path":"http://www.schlosslab.org/schtools/dev/index.html","id":"schtools-","dir":"","previous_headings":"","what":"Schloss Lab Tools for Reproducible Microbiome Research","title":"Schloss Lab Tools for Reproducible Microbiome Research","text":"Schloss Lab Tools Reproducible Microbiome Research 💩 collection useful functions example code created used Schloss Lab reproducible microbiome research. Perform common tasks like read output files mothur, tidy microbiome data, format rmarkdown documents publication. See website information, documentation, examples.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Schloss Lab Tools for Reproducible Microbiome Research","text":"can install latest release CRAN: development version GitHub : install terminal using conda mamba:","code":"install.packages(\"schtools\") # install.packages(\"devtools\") devtools::install_github(\"SchlossLab/schtools\") mamba install -c conda-forge r-schtools"},{"path":"http://www.schlosslab.org/schtools/dev/index.html","id":"usage","dir":"","previous_headings":"","what":"Usage","title":"Schloss Lab Tools for Reproducible Microbiome Research","text":"Check introductory vignette quick start tutorial take look reference documentation comprehensive list functions.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/index.html","id":"help--contributing","dir":"","previous_headings":"","what":"Help & Contributing","title":"Schloss Lab Tools for Reproducible Microbiome Research","text":"questions, create new post Discussions. come across bug, open issue include minimal reproducible example. ’d like contribute, see guidelines .","code":""},{"path":"http://www.schlosslab.org/schtools/dev/index.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Schloss Lab Tools for Reproducible Microbiome Research","text":"Please note schtools project released Contributor Code Conduct. contributing project, agree abide terms.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/index.html","id":"license","dir":"","previous_headings":"","what":"License","title":"Schloss Lab Tools for Reproducible Microbiome Research","text":"schtools package licensed MIT license. logo licensed CC -SA license.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/index.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Schloss Lab Tools for Reproducible Microbiome Research","text":"cite schtools publications, use: Sovacool K, Lesniak N, Schloss P (2022). schtools: Schloss Lab Tools Reproducible Microbiome Research. http://www.schlosslab.org/schtools/, https://github.com/SchlossLab/schtools. BibTeX entry LaTeX users :","code":"@Manual{, title = {schtools: Schloss Lab Tools for Reproducible Microbiome Research}, author = {Kelly Sovacool and Nick Lesniak and Patrick Schloss}, year = {2022}, note = {http://www.schlosslab.org/schtools/, https://github.com/SchlossLab/schtools}, }"},{"path":"http://www.schlosslab.org/schtools/dev/pull_request_template.html","id":"issues","dir":"","previous_headings":"","what":"Issues","title":"NA","text":"Resolves # .","code":""},{"path":[]},{"path":"http://www.schlosslab.org/schtools/dev/pull_request_template.html","id":"checklist","dir":"","previous_headings":"","what":"Checklist","title":"NA","text":"(Strikethrough points applicable.) Write unit tests new functionality. Update roxygen comments & vignettes API changes. Update NEWS.md includes user-facing changes. check workflow succeeds recent commit.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/calc_relabun.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate OTU relative abundances from a shared file — calc_relabun","title":"Calculate OTU relative abundances from a shared file — calc_relabun","text":"Calculate OTU relative abundances shared file","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/calc_relabun.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate OTU relative abundances from a shared file — calc_relabun","text":"","code":"calc_relabun(abs_abun_dat)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/calc_relabun.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate OTU relative abundances from a shared file — calc_relabun","text":"abs_abun_dat data frame reading shared file. contain Group column sample names, Otu columns absolute counts OTU, rows sample.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/calc_relabun.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculate OTU relative abundances from a shared file — calc_relabun","text":"new data frame OTU relative abundances long format.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/calc_relabun.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Calculate OTU relative abundances from a shared file — calc_relabun","text":"Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/calc_relabun.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Calculate OTU relative abundances from a shared file — calc_relabun","text":"","code":"shared_dat <- readr::read_tsv(system.file(\"extdata\", \"test.shared\", package = \"schtools\" )) #> Rows: 10 Columns: 15 #> ── Column specification ──────────────────────────────────────────────────────── #> Delimiter: \"\\t\" #> chr (1): Group #> dbl (14): label, numOtus, Otu0001, Otu0003, Otu0004, Otu00008, Otu0044, Otu0... #> #> ℹ Use `spec()` to retrieve the full column specification for this data. #> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message. shared_dat %>% calc_relabun() #> # A tibble: 120 × 3 #> sample otu rel_abun #> #> 1 p1 Otu0001 0 #> 2 p1 Otu0003 0 #> 3 p1 Otu0004 0 #> 4 p1 Otu00008 0 #> 5 p1 Otu0044 0.25 #> 6 p1 Otu0056 0.25 #> 7 p1 Otu0057 0 #> 8 p1 Otu0058 0.25 #> 9 p1 Otu0159 0 #> 10 p1 Otu0208 0.25 #> # … with 110 more rows"},{"path":"http://www.schlosslab.org/schtools/dev/reference/close_enough.html","id":null,"dir":"Reference","previous_headings":"","what":"Check whether two numeric vectors are close enough for gov't work. — close_enough","title":"Check whether two numeric vectors are close enough for gov't work. — close_enough","text":"like dplyr::near() except much less precision.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/close_enough.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check whether two numeric vectors are close enough for gov't work. — close_enough","text":"","code":"close_enough(x, y, tol = 10^-3)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/close_enough.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check whether two numeric vectors are close enough for gov't work. — close_enough","text":"x numeric vector y another numeric vector tol tolerance (default: 10^-3.)","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/close_enough.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check whether two numeric vectors are close enough for gov't work. — close_enough","text":"TRUE numbers near enough within tolerance, otherwise FALSE","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/close_enough.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Check whether two numeric vectors are close enough for gov't work. — close_enough","text":"Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/close_enough.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check whether two numeric vectors are close enough for gov't work. — close_enough","text":"","code":"close_enough(0.0004, 0) #> [1] TRUE close_enough(0.8887, 0.8884) #> [1] TRUE close_enough(1, 2) #> [1] FALSE"},{"path":"http://www.schlosslab.org/schtools/dev/reference/format_number.html","id":null,"dir":"Reference","previous_headings":"","what":"Format human-readable numbers. — format_number","title":"Format human-readable numbers. — format_number","text":"Pastes formatted x numeric, otherwise x unmodified. Circumvents R's automatic scientific notation. number nearly whole (see is_nearly_whole()), rounded zero decimal places. Otherwise, numbers >= 1 rounded 1 decimal place; numbers < 1 rounded 2 significant digits.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/format_number.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Format human-readable numbers. — format_number","text":"","code":"format_number(x, nsmall = 1, signif_precise = 2)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/format_number.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Format human-readable numbers. — format_number","text":"x inline code nsmall number digits decimal point round x nearly whole x >= 1. signif_precise number significant digits use x nearly whole","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/format_number.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Format human-readable numbers. — format_number","text":"formatted x numeric, otherwise x unmodified.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/format_number.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Format human-readable numbers. — format_number","text":"Pat Schloss pschloss@umich.edu Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/format_number.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Format human-readable numbers. — format_number","text":"","code":"format_number(0.0256) #> [1] \"0.026\" format_number(.Machine$double.eps^0.5) #> [1] \"0.000000015\" format_number(100000.08) #> [1] \"100,000.1\" format_number(1.00000000000000000001) #> [1] \"1\" format_number(\"this is a string\") #> [1] \"this is a string\""},{"path":"http://www.schlosslab.org/schtools/dev/reference/inline_hook.html","id":null,"dir":"Reference","previous_headings":"","what":"Inline hook for knitr to paste human-readable numbers and nice lists. — inline_hook","title":"Inline hook for knitr to paste human-readable numbers and nice lists. — inline_hook","text":"Inline hook knitr paste human-readable numbers nice lists.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/inline_hook.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Inline hook for knitr to paste human-readable numbers and nice lists. — inline_hook","text":"","code":"inline_hook(x)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/inline_hook.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Inline hook for knitr to paste human-readable numbers and nice lists. — inline_hook","text":"x just anything","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/inline_hook.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Inline hook for knitr to paste human-readable numbers and nice lists. — inline_hook","text":"string element x separated comma numbers human-readable format.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/inline_hook.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Inline hook for knitr to paste human-readable numbers and nice lists. — inline_hook","text":"Kelly Sovacool sovacool@umich.edu Pat Schloss pschloss@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/inline_hook.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Inline hook for knitr to paste human-readable numbers and nice lists. — inline_hook","text":"","code":"inline_hook(c(1.2993992, 0.03, 1000)) #> [1] \"1.3, 0.03, and 1,000\" inline_hook(c(\"cats\", \"dogs\")) #> [1] \"cats and dogs\""},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nearly_whole.html","id":null,"dir":"Reference","previous_headings":"","what":"Checks whether a number is near to a whole number — is_nearly_whole","title":"Checks whether a number is near to a whole number — is_nearly_whole","text":"Checks whether number near whole number","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nearly_whole.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Checks whether a number is near to a whole number — is_nearly_whole","text":"","code":"is_nearly_whole(x)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nearly_whole.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Checks whether a number is near to a whole number — is_nearly_whole","text":"x numeric","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nearly_whole.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Checks whether a number is near to a whole number — is_nearly_whole","text":"TRUE FALSE","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nearly_whole.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Checks whether a number is near to a whole number — is_nearly_whole","text":"Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nearly_whole.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Checks whether a number is near to a whole number — is_nearly_whole","text":"","code":"is_nearly_whole(.Machine$double.eps^0.5) #> [1] FALSE is_nearly_whole(.Machine$double.eps^0.6) #> [1] TRUE is_nearly_whole(1) #> [1] TRUE"},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nondesc.html","id":null,"dir":"Reference","previous_headings":"","what":"Check whether all elements given are sorted in non-descending order — is_nondesc","title":"Check whether all elements given are sorted in non-descending order — is_nondesc","text":"Check whether elements given sorted non-descending order","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nondesc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check whether all elements given are sorted in non-descending order — is_nondesc","text":"","code":"is_nondesc(...)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nondesc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check whether all elements given are sorted in non-descending order — is_nondesc","text":"... anything!","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nondesc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check whether all elements given are sorted in non-descending order — is_nondesc","text":"TRUE elements sorted non-descending order, otherwise FALSE","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nondesc.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Check whether all elements given are sorted in non-descending order — is_nondesc","text":"Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/is_nondesc.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check whether all elements given are sorted in non-descending order — is_nondesc","text":"","code":"is_nondesc(1, 2, 3) #> [1] TRUE is_nondesc(c(1, 2), 3) #> [1] TRUE is_nondesc(6, 4, 1) #> [1] FALSE is_nondesc(\"a\", \"b\", \"c\") #> [1] TRUE is_nondesc(c(\"z\", \"y\")) #> [1] FALSE"},{"path":"http://www.schlosslab.org/schtools/dev/reference/load_deps.html","id":null,"dir":"Reference","previous_headings":"","what":"Install & load packages — load_deps","title":"Install & load packages — load_deps","text":"Install & load packages","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/load_deps.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Install & load packages — load_deps","text":"","code":"load_deps(...)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/load_deps.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Install & load packages — load_deps","text":"... package names install & load","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/load_deps.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Install & load packages — load_deps","text":"Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/log_snakemake.html","id":null,"dir":"Reference","previous_headings":"","what":"Save output, messages, warnings, and errors to the Snakemake log file — log_snakemake","title":"Save output, messages, warnings, and errors to the Snakemake log file — log_snakemake","text":"function checks whether log file specified Snakemake rule. , directs output, messages, warnings, errors rule-specific log file. See Snakemake documentation log files R scripts details.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/log_snakemake.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Save output, messages, warnings, and errors to the Snakemake log file — log_snakemake","text":"","code":"log_snakemake(quiet = TRUE)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/log_snakemake.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Save output, messages, warnings, and errors to the Snakemake log file — log_snakemake","text":"quiet Silence messages status snakemake object log file (default: TRUE).","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/log_snakemake.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Save output, messages, warnings, and errors to the Snakemake log file — log_snakemake","text":"Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/log_snakemake.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Save output, messages, warnings, and errors to the Snakemake log file — log_snakemake","text":"","code":"# The Snakemake object doesn't exist, so nothing happens log_snakemake(quiet = FALSE) #> No Snakemake object exists, so all output will print as usual"},{"path":"http://www.schlosslab.org/schtools/dev/reference/parse_tax.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert taxonomy strings into dataframe of labels based on taxonomic classification — parse_tax","title":"Convert taxonomy strings into dataframe of labels based on taxonomic classification — parse_tax","text":"Convert taxonomy strings dataframe labels based taxonomic classification","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/parse_tax.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert taxonomy strings into dataframe of labels based on taxonomic classification — parse_tax","text":"","code":"parse_tax(dat)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/parse_tax.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert taxonomy strings into dataframe of labels based on taxonomic classification — parse_tax","text":"dat dataframe mothur taxonomy file columns OTU, Size, Taxonomy","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/parse_tax.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert taxonomy strings into dataframe of labels based on taxonomic classification — parse_tax","text":"wide dataframe taxonomic labels","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/parse_tax.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Convert taxonomy strings into dataframe of labels based on taxonomic classification — parse_tax","text":"Nick Lesniak, nlesniak@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/parse_tax.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert taxonomy strings into dataframe of labels based on taxonomic classification — parse_tax","text":"","code":"taxonomy_filepath <- system.file(\"extdata\", \"test.taxonomy\", package = \"schtools\" ) taxonomy_tbl <- read_tax(taxonomy_filepath) head(taxonomy_tbl) #> # A tibble: 6 × 10 #> otu otu_label tax_otu_l…¹ label…² kingdom phylum class order family genus #> #> 1 Otu0001 OTU 1 Bacteroide… Bac… Bacter… Bacte… Bact… Bact… Bacte… Bact… #> 2 Otu0003 OTU 3 Porphyromo… Por… Bacter… Bacte… Bact… Bact… Porph… Porp… #> 3 Otu0004 OTU 4 Porphyromo… Por… Bacter… Bacte… Bact… Bact… Porph… Porp… #> 4 Otu00008 OTU 8 Enterobact… Ent… Bacter… Prote… Gamm… Ente… Enter… Ente… #> 5 Otu0044 OTU 44 Bacteria (… Bac… Bacter… Bacte… Bact… Bact… Bacte… Bact… #> 6 Otu0056 OTU 56 Bacteria (… Bac… Bacter… Bacte… Bact… Bact… Bacte… Bact… #> # … with abbreviated variable names ¹​tax_otu_label, ²​label_html"},{"path":"http://www.schlosslab.org/schtools/dev/reference/paste_oxford_list.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a prose string from a list or vector — paste_oxford_list","title":"Create a prose string from a list or vector — paste_oxford_list","text":"word '' inserted last element Oxford comma used.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/paste_oxford_list.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a prose string from a list or vector — paste_oxford_list","text":"","code":"paste_oxford_list(x)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/paste_oxford_list.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a prose string from a list or vector — paste_oxford_list","text":"x list vector","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/paste_oxford_list.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a prose string from a list or vector — paste_oxford_list","text":"string element x separated comma","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/paste_oxford_list.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Create a prose string from a list or vector — paste_oxford_list","text":"Pat Schloss pschloss@umich.edu Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/paste_oxford_list.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a prose string from a list or vector — paste_oxford_list","text":"","code":"paste_oxford_list(1:3) #> [1] \"1, 2, and 3\" paste_oxford_list(c(\"cats\", \"dogs\", \"turtles\")) #> [1] \"cats, dogs, and turtles\""},{"path":"http://www.schlosslab.org/schtools/dev/reference/pool_taxon_counts.html","id":null,"dir":"Reference","previous_headings":"","what":"Pool OTU counts at a particular taxonomic level — pool_taxon_counts","title":"Pool OTU counts at a particular taxonomic level — pool_taxon_counts","text":"Enables comparing analyses different taxonomic resolutions, seen https://doi.org/10.1128/mbio.03161-21. Implementation adapted .","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/pool_taxon_counts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pool OTU counts at a particular taxonomic level — pool_taxon_counts","text":"","code":"pool_taxon_counts(otu_shared_dat, otu_tax_dat, taxon_level)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/pool_taxon_counts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pool OTU counts at a particular taxonomic level — pool_taxon_counts","text":"otu_shared_dat data frame created shared file OTU level. otu_tax_dat data frame created taxonomy file OTU level. Must dataset shared file. taxon_level taxonomic level pool OTUs (kingdom, phylum, class, order, family, genus). column otu_tax_dat.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/pool_taxon_counts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pool OTU counts at a particular taxonomic level — pool_taxon_counts","text":"shared data frame OTUs specified taxon_level corresponding taxonomy dataframe new OTU numbers.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/pool_taxon_counts.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Pool OTU counts at a particular taxonomic level — pool_taxon_counts","text":"Kelly Sovacool, sovacool@umich.edu Pat Schloss pschloss@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/pool_taxon_counts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Pool OTU counts at a particular taxonomic level — pool_taxon_counts","text":"","code":"tax_dat <- read_tax(system.file(\"extdata\", \"test.taxonomy\", package = \"schtools\" )) shared_dat <- readr::read_tsv(system.file(\"extdata\", \"test.shared\", package = \"schtools\" )) #> Rows: 10 Columns: 15 #> ── Column specification ──────────────────────────────────────────────────────── #> Delimiter: \"\\t\" #> chr (1): Group #> dbl (14): label, numOtus, Otu0001, Otu0003, Otu0004, Otu00008, Otu0044, Otu0... #> #> ℹ Use `spec()` to retrieve the full column specification for this data. #> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message. pool_taxon_counts(shared_dat, tax_dat, genus) #> $shared #> # A tibble: 10 × 13 #> label Group numOtus Otu01 Otu02 Otu03 Otu04 Otu05 Otu06 Otu07 Otu08 Otu09 #> #> 1 genus p1 10 0 0 0 2 0 1 0 1 0 #> 2 genus p10 10 1 0 1 0 1 0 1 1 1 #> 3 genus p2 10 1 1 0 1 0 1 0 0 1 #> 4 genus p3 10 0 1 0 1 0 0 1 0 1 #> 5 genus p4 10 1 1 1 0 0 0 0 0 0 #> 6 genus p5 10 1 1 0 1 0 0 0 0 1 #> 7 genus p6 10 1 0 1 1 1 1 0 0 1 #> 8 genus p7 10 0 0 0 1 1 0 1 0 1 #> 9 genus p8 10 0 1 1 2 0 0 1 1 0 #> 10 genus p9 10 0 1 1 2 0 0 1 1 1 #> # … with 1 more variable: Otu10 #> #> $tax #> # A tibble: 10 × 3 #> otu size genus #> #> 1 Otu01 5 Bacteroides #> 2 Otu02 6 Porphyromonadaceae unclassified #> 3 Otu03 5 Enterobacteriaceae unclassified #> 4 Otu04 11 Bacteria unclassified #> 5 Otu05 3 Acinetobacter #> 6 Otu06 3 Clostridium XlVa #> 7 Otu07 5 Betaproteobacteria unclassified #> 8 Otu08 4 Clostridium XVIII #> 9 Otu09 7 Candidatus Saccharibacteria unclassified #> 10 Otu10 5 Clostridiales Incertae Sedis XIII unclassified #> pool_taxon_counts(shared_dat, tax_dat, family) #> $shared #> # A tibble: 10 × 13 #> label Group numOtus Otu01 Otu02 Otu03 Otu04 Otu05 Otu06 Otu07 Otu08 Otu09 #> #> 1 family p1 10 0 0 0 2 0 1 0 1 0 #> 2 family p10 10 1 0 1 0 1 0 1 1 1 #> 3 family p2 10 1 1 0 1 0 1 0 0 1 #> 4 family p3 10 0 1 0 1 0 0 1 0 1 #> 5 family p4 10 1 1 1 0 0 0 0 0 0 #> 6 family p5 10 1 1 0 1 0 0 0 0 1 #> 7 family p6 10 1 0 1 1 1 1 0 0 1 #> 8 family p7 10 0 0 0 1 1 0 1 0 1 #> 9 family p8 10 0 1 1 2 0 0 1 1 0 #> 10 family p9 10 0 1 1 2 0 0 1 1 1 #> # … with 1 more variable: Otu10 #> #> $tax #> # A tibble: 10 × 3 #> otu size family #> #> 1 Otu01 5 Bacteroidaceae #> 2 Otu02 6 Porphyromonadaceae #> 3 Otu03 5 Enterobacteriaceae #> 4 Otu04 11 Bacteria unclassified #> 5 Otu05 3 Moraxellaceae #> 6 Otu06 3 Lachnospiraceae #> 7 Otu07 5 Betaproteobacteria unclassified #> 8 Otu08 4 Erysipelotrichaceae #> 9 Otu09 7 Candidatus Saccharibacteria unclassified #> 10 Otu10 5 Clostridiales Incertae Sedis XIII #> pool_taxon_counts(shared_dat, tax_dat, phylum) #> $shared #> # A tibble: 10 × 8 #> label Group numOtus Otu1 Otu2 Otu3 Otu4 Otu5 #> #> 1 phylum p1 5 0 0 2 2 0 #> 2 phylum p10 5 1 3 0 1 1 #> 3 phylum p2 5 2 0 1 2 1 #> 4 phylum p3 5 1 1 1 1 1 #> 5 phylum p4 5 2 1 0 1 0 #> 6 phylum p5 5 2 0 1 0 1 #> 7 phylum p6 5 1 2 1 1 1 #> 8 phylum p7 5 0 2 1 1 1 #> 9 phylum p8 5 1 2 2 1 0 #> 10 phylum p9 5 1 2 2 2 1 #> #> $tax #> # A tibble: 5 × 3 #> otu size phylum #> #> 1 Otu1 11 Bacteroidetes #> 2 Otu2 13 Proteobacteria #> 3 Otu3 11 Bacteria unclassified #> 4 Otu4 12 Firmicutes #> 5 Otu5 7 Candidatus Saccharibacteria #>"},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_dist.html","id":null,"dir":"Reference","previous_headings":"","what":"Read in lower left triangular matrix from file — read_dist","title":"Read in lower left triangular matrix from file — read_dist","text":"Read lower left triangular matrix file","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_dist.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read in lower left triangular matrix from file — read_dist","text":"","code":"read_dist(dist_filename)"},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_dist.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read in lower left triangular matrix from file — read_dist","text":"dist_filename filename lower left triangular matrix (.dist)","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_dist.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read in lower left triangular matrix from file — read_dist","text":"distance matrix tibble","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_dist.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Read in lower left triangular matrix from file — read_dist","text":"Nick Lesniak, nlesniak@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_dist.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read in lower left triangular matrix from file — read_dist","text":"","code":"dist_filepath <- system.file(\"extdata\", \"sample.final.thetayc.0.03.lt.ave.dist\", package = \"schtools\" ) dist_tbl <- read_dist(dist_filepath) head(dist_tbl) #> # A tibble: 6 × 3 #> rows columns distances #> #> 1 104_1_D1 104_1_D0 0.893 #> 2 104_1_D10 104_1_D0 0.254 #> 3 104_1_D10 104_1_D1 0.922 #> 4 104_1_D2 104_1_D0 0.874 #> 5 104_1_D2 104_1_D1 0.109 #> 6 104_1_D2 104_1_D10 0.904"},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_tax.html","id":null,"dir":"Reference","previous_headings":"","what":"Read in a taxonomy file and parse it to a wide dataframe — read_tax","title":"Read in a taxonomy file and parse it to a wide dataframe — read_tax","text":"Read taxonomy file parse wide dataframe","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_tax.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read in a taxonomy file and parse it to a wide dataframe — read_tax","text":"","code":"read_tax(taxonomy_filename, sep = \"\\t\")"},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_tax.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read in a taxonomy file and parse it to a wide dataframe — read_tax","text":"taxonomy_filename filename taxonomy file sep Character separates fields taxonomy file. (Default: \\t).","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_tax.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read in a taxonomy file and parse it to a wide dataframe — read_tax","text":"dataframe taxonomic labels, formatted parse_tax()","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_tax.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Read in a taxonomy file and parse it to a wide dataframe — read_tax","text":"Nick Lesniak, nlesniak@umich.edu Kelly Sovacool, sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/read_tax.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read in a taxonomy file and parse it to a wide dataframe — read_tax","text":"","code":"taxonomy_filepath <- system.file(\"extdata\", \"test.taxonomy\", package = \"schtools\" ) taxonomy_tbl <- read_tax(taxonomy_filepath) head(taxonomy_tbl) #> # A tibble: 6 × 10 #> otu otu_label tax_otu_l…¹ label…² kingdom phylum class order family genus #> #> 1 Otu0001 OTU 1 Bacteroide… Bac… Bacter… Bacte… Bact… Bact… Bacte… Bact… #> 2 Otu0003 OTU 3 Porphyromo… Por… Bacter… Bacte… Bact… Bact… Porph… Porp… #> 3 Otu0004 OTU 4 Porphyromo… Por… Bacter… Bacte… Bact… Bact… Porph… Porp… #> 4 Otu00008 OTU 8 Enterobact… Ent… Bacter… Prote… Gamm… Ente… Enter… Ente… #> 5 Otu0044 OTU 44 Bacteria (… Bac… Bacter… Bacte… Bact… Bact… Bacte… Bact… #> 6 Otu0056 OTU 56 Bacteria (… Bac… Bacter… Bacte… Bact… Bact… Bacte… Bact… #> # … with abbreviated variable names ¹​tax_otu_label, ²​label_html"},{"path":"http://www.schlosslab.org/schtools/dev/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"dplyr pipe — reexports","title":"dplyr pipe — reexports","text":"objects imported packages. Follow links see documentation. dplyr %>% rlang .data","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/schtools.html","id":null,"dir":"Reference","previous_headings":"","what":"schtools: Schloss Lab Tools for Reproducible Microbiome Research — schtools","title":"schtools: Schloss Lab Tools for Reproducible Microbiome Research — schtools","text":"collection useful functions example code created used Schloss Lab reproducible microbiome research. Perform common tasks like read files created mothur, tidy microbiome data, format rmarkdown documents publication. See website information, documentation, examples.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/set_knitr_opts.html","id":null,"dir":"Reference","previous_headings":"","what":"Set knitr chunk options & inline hook — set_knitr_opts","title":"Set knitr chunk options & inline hook — set_knitr_opts","text":"Call function setup chunk R Markdown files.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/set_knitr_opts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set knitr chunk options & inline hook — set_knitr_opts","text":"","code":"set_knitr_opts()"},{"path":"http://www.schlosslab.org/schtools/dev/reference/set_knitr_opts.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Set knitr chunk options & inline hook — set_knitr_opts","text":"Pat Schloss pschloss@umich.edu Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/theme_lucas.html","id":null,"dir":"Reference","previous_headings":"","what":"Sarah's go-to theme for ggplot2 — theme_lucas","title":"Sarah's go-to theme for ggplot2 — theme_lucas","text":"Requires hrbrthemes package PT Sans PT Sans Narrow fonts Google Fonts.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/theme_lucas.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sarah's go-to theme for ggplot2 — theme_lucas","text":"","code":"theme_lucas()"},{"path":"http://www.schlosslab.org/schtools/dev/reference/theme_lucas.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Sarah's go-to theme for ggplot2 — theme_lucas","text":"list ggproto objects","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/theme_lucas.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Sarah's go-to theme for ggplot2 — theme_lucas","text":"Sarah Lucas salucas@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/theme_lucas.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Sarah's go-to theme for ggplot2 — theme_lucas","text":"","code":"library(ggplot2) library(showtext) #> Loading required package: sysfonts #> Loading required package: showtextdb # run once to download the PT Sans fonts font_add_google(name = \"PT Sans\", family = \"PT Sans\") font_add_google(name = \"PT Sans Narrow\", family = \"PT Sans Narrow\") showtext_auto() # make a plot with theme_lucas() ggplot(mtcars) + aes(x = mpg, y = wt, color = cyl) + geom_point() + theme_lucas()"},{"path":"http://www.schlosslab.org/schtools/dev/reference/theme_sovacool.html","id":null,"dir":"Reference","previous_headings":"","what":"Kelly's go-to theme for ggplot2 — theme_sovacool","title":"Kelly's go-to theme for ggplot2 — theme_sovacool","text":"Uses ggplot2::theme_bw() removes margins.","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/theme_sovacool.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Kelly's go-to theme for ggplot2 — theme_sovacool","text":"","code":"theme_sovacool()"},{"path":"http://www.schlosslab.org/schtools/dev/reference/theme_sovacool.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Kelly's go-to theme for ggplot2 — theme_sovacool","text":"list ggproto objects","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/theme_sovacool.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Kelly's go-to theme for ggplot2 — theme_sovacool","text":"Kelly Sovacool sovacool@umich.edu","code":""},{"path":"http://www.schlosslab.org/schtools/dev/reference/theme_sovacool.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Kelly's go-to theme for ggplot2 — theme_sovacool","text":"","code":"library(ggplot2) ggplot(mtcars) + aes(x = mpg, y = wt, color = cyl) + geom_point() + theme_sovacool()"},{"path":"http://www.schlosslab.org/schtools/dev/news/index.html","id":"schtools-021","dir":"Changelog","previous_headings":"","what":"schtools 0.2.1","title":"schtools 0.2.1","text":"CRAN release: 2022-05-11 New column label_html provides HTML correctly italicize genus names OTU labels. Added example intro vignette demonstrate using feature ggtext. Changed taxonomy data frame column names lowercase reordered . Minor documentation improvements (#33, @kelly-sovacool).","code":""},{"path":"http://www.schlosslab.org/schtools/dev/news/index.html","id":"schtools-011","dir":"Changelog","previous_headings":"","what":"schtools 0.1.1","title":"schtools 0.1.1","text":"CRAN release: 2022-03-11 New function parse_tax() separate logic reading parsing taxonomy files. read_tax() now accepts sep parameter handle different delim file types (e.g. csv tsv). schtools now logo! (#31, @kelly-sovacool)","code":""},{"path":"http://www.schlosslab.org/schtools/dev/news/index.html","id":"schtools-010","dir":"Changelog","previous_headings":"","what":"schtools 0.1.0","title":"schtools 0.1.0","text":"CRAN release: 2021-11-22 first release version schtools! 🎉 can now install schtools CRAN! Added NEWS.md file track changes package. read_dist() (#10, @NLesniak) read_tax() (#22, @NLesniak) set_knitr_opts() (#21, @pschloss, @kelly-sovacool) inline_hook() (#21, @pschloss, @kelly-sovacool) paste_oxford_list() (#21, @pschloss, @kelly-sovacool) format_number() (#24, @pschloss, @kelly-sovacool) is_nearly_whole() (#24, @pschloss, @kelly-sovacool) close_enough() (#26, @kelly-sovacool) is_nondesc() (#28, @kelly-sovacool) introduction","code":""}] diff --git a/docs/dev/sitemap.xml b/docs/dev/sitemap.xml index e381e5e..1a5da12 100644 --- a/docs/dev/sitemap.xml +++ b/docs/dev/sitemap.xml @@ -90,4 +90,10 @@ http://www.schlosslab.org/schtools/dev/reference/set_knitr_opts.html + + http://www.schlosslab.org/schtools/dev/reference/theme_lucas.html + + + http://www.schlosslab.org/schtools/dev/reference/theme_sovacool.html + diff --git a/man/calc_relabun.Rd b/man/calc_relabun.Rd index 49795fb..8b88466 100644 --- a/man/calc_relabun.Rd +++ b/man/calc_relabun.Rd @@ -20,7 +20,8 @@ Calculate OTU relative abundances from a shared file } \examples{ shared_dat <- readr::read_tsv(system.file("extdata", "test.shared", - package = "schtools")) + package = "schtools" +)) shared_dat \%>\% calc_relabun() } \author{ diff --git a/man/theme_lucas.Rd b/man/theme_lucas.Rd new file mode 100644 index 0000000..be2cbb4 --- /dev/null +++ b/man/theme_lucas.Rd @@ -0,0 +1,33 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/plot.R +\name{theme_lucas} +\alias{theme_lucas} +\title{Sarah's go-to theme for ggplot2} +\usage{ +theme_lucas() +} +\value{ +list of ggproto objects +} +\description{ +Requires the \code{hrbrthemes} package and the \verb{PT Sans} and \verb{PT Sans Narrow} +fonts from Google Fonts. +} +\examples{ +library(ggplot2) +library(showtext) + +# run once to download the PT Sans fonts +font_add_google(name = "PT Sans", family = "PT Sans") +font_add_google(name = "PT Sans Narrow", family = "PT Sans Narrow") +showtext_auto() + +# make a plot with theme_lucas() +ggplot(mtcars) + + aes(x = mpg, y = wt, color = cyl) + + geom_point() + + theme_lucas() +} +\author{ +Sarah Lucas \email{salucas@umich.edu} +} diff --git a/man/theme_sovacool.Rd b/man/theme_sovacool.Rd new file mode 100644 index 0000000..e64e064 --- /dev/null +++ b/man/theme_sovacool.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/plot.R +\name{theme_sovacool} +\alias{theme_sovacool} +\title{Kelly's go-to theme for ggplot2} +\usage{ +theme_sovacool() +} +\value{ +list of ggproto objects +} +\description{ +Uses \code{ggplot2::theme_bw()} and removes margins. +} +\examples{ +library(ggplot2) +ggplot(mtcars) + + aes(x = mpg, y = wt, color = cyl) + + geom_point() + + theme_sovacool() +} +\author{ +Kelly Sovacool \email{sovacool@umich.edu} +} diff --git a/tests/testthat/test-plot.R b/tests/testthat/test-plot.R new file mode 100644 index 0000000..2addfc9 --- /dev/null +++ b/tests/testthat/test-plot.R @@ -0,0 +1,767 @@ +library(ggplot2) +plot_sovacool <- ggplot(mtcars) + + aes(x = mpg, y = wt, color = cyl) + + geom_point() + + theme_sovacool() +test_that("theme_sovacool works", { + expect_equal( + plot_sovacool$theme, + structure( + list( + line = structure( + list( + colour = "black", + size = 0.5, + linetype = 1, + lineend = "butt", + arrow = FALSE, + inherit.blank = TRUE + ), + class = c( + "element_line", + "element" + ) + ), + rect = structure( + list( + fill = "white", + colour = "black", + size = 0.5, + linetype = 1, + inherit.blank = TRUE + ), + class = c( + "element_rect", + "element" + ) + ), + text = structure( + list( + family = "", + face = "plain", + colour = "black", + size = 11, + hjust = 0.5, + vjust = 0.5, + angle = 0, + lineheight = 0.9, + margin = structure( + c(0, 0, 0, 0), + unit = 8L, + class = c( + "margin", + "simpleUnit", "unit", "unit_v2" + ) + ), + debug = FALSE, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ), + title = NULL, + aspect.ratio = NULL, + axis.title = NULL, + axis.title.x = structure( + list( + family = NULL, + face = NULL, + colour = NULL, + size = NULL, + hjust = NULL, + vjust = 1, + angle = NULL, + lineheight = NULL, + margin = structure( + c( + 2.75, + 0, 0, 0 + ), + unit = 8L, + class = c( + "margin", "simpleUnit", + "unit", "unit_v2" + ) + ), + debug = NULL, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ), + axis.title.x.top = structure( + list( + family = NULL, + face = NULL, + colour = NULL, + size = NULL, + hjust = NULL, + vjust = 0, + angle = NULL, + lineheight = NULL, + margin = structure( + c( + 0, + 0, 2.75, 0 + ), + unit = 8L, + class = c( + "margin", "simpleUnit", + "unit", "unit_v2" + ) + ), + debug = NULL, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ), + axis.title.x.bottom = NULL, + axis.title.y = structure( + list( + family = NULL, + face = NULL, + colour = NULL, + size = NULL, + hjust = NULL, + vjust = 1, + angle = 90, + lineheight = NULL, + margin = structure( + c(0, 2.75, 0, 0), + unit = 8L, + class = c( + "margin", + "simpleUnit", "unit", "unit_v2" + ) + ), + debug = NULL, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ), + axis.title.y.left = NULL, + axis.title.y.right = structure( + list( + family = NULL, + face = NULL, + colour = NULL, + size = NULL, + hjust = NULL, + vjust = 0, + angle = -90, + lineheight = NULL, + margin = structure( + c(0, 0, 0, 2.75), + unit = 8L, + class = c( + "margin", + "simpleUnit", "unit", "unit_v2" + ) + ), + debug = NULL, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ), + axis.text = structure( + list( + family = NULL, + face = NULL, + colour = "grey30", + size = structure(0.8, class = "rel"), + hjust = NULL, + vjust = NULL, + angle = NULL, + lineheight = NULL, + margin = NULL, + debug = NULL, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ), + axis.text.x = structure( + list( + family = NULL, + face = NULL, + colour = NULL, + size = NULL, + hjust = NULL, + vjust = 1, + angle = NULL, + lineheight = NULL, + margin = structure( + c( + 2.2, + 0, 0, 0 + ), + unit = 8L, + class = c( + "margin", "simpleUnit", + "unit", "unit_v2" + ) + ), + debug = NULL, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ), + axis.text.x.top = structure( + list( + family = NULL, + face = NULL, + colour = NULL, + size = NULL, + hjust = NULL, + vjust = 0, + angle = NULL, + lineheight = NULL, + margin = structure( + c( + 0, + 0, 2.2, 0 + ), + unit = 8L, + class = c( + "margin", "simpleUnit", + "unit", "unit_v2" + ) + ), + debug = NULL, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ), + axis.text.x.bottom = NULL, + axis.text.y = structure( + list( + family = NULL, + face = NULL, + colour = NULL, + size = NULL, + hjust = 1, + vjust = NULL, + angle = NULL, + lineheight = NULL, + margin = structure( + c(0, 2.2, 0, 0), + unit = 8L, + class = c( + "margin", + "simpleUnit", "unit", "unit_v2" + ) + ), + debug = NULL, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ), + axis.text.y.left = NULL, + axis.text.y.right = structure( + list( + family = NULL, + face = NULL, + colour = NULL, + size = NULL, + hjust = 0, + vjust = NULL, + angle = NULL, + lineheight = NULL, + margin = structure( + c(0, 0, 0, 2.2), + unit = 8L, + class = c( + "margin", + "simpleUnit", "unit", "unit_v2" + ) + ), + debug = NULL, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ), + axis.ticks = structure( + list( + colour = "grey20", + size = NULL, + linetype = NULL, + lineend = NULL, + arrow = FALSE, + inherit.blank = TRUE + ), + class = c("element_line", "element") + ), + axis.ticks.x = NULL, + axis.ticks.x.top = NULL, + axis.ticks.x.bottom = NULL, + axis.ticks.y = NULL, + axis.ticks.y.left = NULL, + axis.ticks.y.right = NULL, + axis.ticks.length = structure( + 2.75, + unit = 8L, + class = c( + "simpleUnit", + "unit", "unit_v2" + ) + ), + axis.ticks.length.x = NULL, + axis.ticks.length.x.top = NULL, + axis.ticks.length.x.bottom = NULL, + axis.ticks.length.y = NULL, + axis.ticks.length.y.left = NULL, + axis.ticks.length.y.right = NULL, + axis.line = structure(list(), class = c( + "element_blank", + "element" + )), + axis.line.x = NULL, + axis.line.x.top = NULL, + axis.line.x.bottom = NULL, + axis.line.y = NULL, + axis.line.y.left = NULL, + axis.line.y.right = NULL, + legend.background = structure( + list( + fill = NULL, + colour = NA, + size = NULL, + linetype = NULL, + inherit.blank = TRUE + ), + class = c("element_rect", "element") + ), + legend.margin = structure( + c(0, 0, 0, 0), + unit = 8L, + class = c( + "margin", + "simpleUnit", "unit", "unit_v2" + ) + ), + legend.spacing = structure( + 11, + unit = 8L, + class = c( + "simpleUnit", + "unit", "unit_v2" + ) + ), + legend.spacing.x = NULL, + legend.spacing.y = NULL, + legend.key = structure( + list( + fill = "white", + colour = NA, + size = NULL, + linetype = NULL, + inherit.blank = TRUE + ), + class = c( + "element_rect", + "element" + ) + ), + legend.key.size = structure( + 1.2, + unit = 3L, + class = c( + "simpleUnit", + "unit", "unit_v2" + ) + ), + legend.key.height = NULL, + legend.key.width = NULL, + legend.text = structure( + list( + family = NULL, + face = NULL, + colour = NULL, + size = structure(0.8, class = "rel"), + hjust = NULL, + vjust = NULL, + angle = NULL, + lineheight = NULL, + margin = NULL, + debug = NULL, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ), + legend.text.align = NULL, + legend.title = structure( + list( + family = NULL, + face = NULL, + colour = NULL, + size = NULL, + hjust = 0, + vjust = NULL, + angle = NULL, + lineheight = NULL, + margin = NULL, + debug = NULL, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ), + legend.title.align = NULL, + legend.position = "right", + legend.direction = NULL, + legend.justification = "center", + legend.box = NULL, + legend.box.just = NULL, + legend.box.margin = structure( + c( + 0, + 0, 0, 0 + ), + unit = 8L, + class = c( + "margin", "simpleUnit", "unit", + "unit_v2" + ) + ), + legend.box.background = structure(list(), class = c( + "element_blank", + "element" + )), + legend.box.spacing = structure( + 11, + unit = 8L, + class = c( + "simpleUnit", + "unit", "unit_v2" + ) + ), + panel.background = structure( + list( + fill = "white", + colour = NA, + size = NULL, + linetype = NULL, + inherit.blank = TRUE + ), + class = c( + "element_rect", + "element" + ) + ), + panel.border = structure( + list( + fill = NA, + colour = "grey20", + size = NULL, + linetype = NULL, + inherit.blank = TRUE + ), + class = c( + "element_rect", + "element" + ) + ), + panel.spacing = structure( + 5.5, + unit = 8L, + class = c( + "simpleUnit", + "unit", "unit_v2" + ) + ), + panel.spacing.x = NULL, + panel.spacing.y = NULL, + panel.grid = structure( + list( + colour = "grey92", + size = NULL, + linetype = NULL, + lineend = NULL, + arrow = FALSE, + inherit.blank = TRUE + ), + class = c( + "element_line", + "element" + ) + ), + panel.grid.major = NULL, + panel.grid.minor = structure( + list( + colour = NULL, + size = structure(0.5, class = "rel"), + linetype = NULL, + lineend = NULL, + arrow = FALSE, + inherit.blank = TRUE + ), + class = c( + "element_line", + "element" + ) + ), + panel.grid.major.x = NULL, + panel.grid.major.y = NULL, + panel.grid.minor.x = NULL, + panel.grid.minor.y = NULL, + panel.ontop = FALSE, + plot.background = structure( + list( + fill = NULL, + colour = "white", + size = NULL, + linetype = NULL, + inherit.blank = TRUE + ), + class = c( + "element_rect", + "element" + ) + ), + plot.title = structure( + list( + family = NULL, + face = NULL, + colour = NULL, + size = structure(1.2, class = "rel"), + hjust = 0, + vjust = 1, + angle = NULL, + lineheight = NULL, + margin = structure( + c(0, 0, 5.5, 0), + unit = 8L, + class = c( + "margin", + "simpleUnit", "unit", "unit_v2" + ) + ), + debug = NULL, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ), + plot.title.position = "panel", + plot.subtitle = structure( + list( + family = NULL, + face = NULL, + colour = NULL, + size = NULL, + hjust = 0, + vjust = 1, + angle = NULL, + lineheight = NULL, + margin = structure( + c(0, 0, 5.5, 0), + unit = 8L, + class = c( + "margin", + "simpleUnit", "unit", "unit_v2" + ) + ), + debug = NULL, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ), + plot.caption = structure( + list( + family = NULL, + face = NULL, + colour = NULL, + size = structure(0.8, class = "rel"), + hjust = 1, + vjust = 1, + angle = NULL, + lineheight = NULL, + margin = structure( + c(5.5, 0, 0, 0), + unit = 8L, + class = c( + "margin", + "simpleUnit", "unit", "unit_v2" + ) + ), + debug = NULL, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ), + plot.caption.position = "panel", + plot.tag = structure( + list( + family = NULL, + face = NULL, + colour = NULL, + size = structure(1.2, class = "rel"), + hjust = 0.5, + vjust = 0.5, + angle = NULL, + lineheight = NULL, + margin = NULL, + debug = NULL, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ), + plot.tag.position = "topleft", + plot.margin = structure( + c( + 0, + 0, 0, 0 + ), + unit = 8L, + class = c( + "margin", "simpleUnit", "unit", + "unit_v2" + ) + ), + strip.background = structure( + list( + fill = "grey85", + colour = "grey20", + size = NULL, + linetype = NULL, + inherit.blank = TRUE + ), + class = c( + "element_rect", + "element" + ) + ), + strip.background.x = NULL, + strip.background.y = NULL, + strip.placement = "inside", + strip.text = structure( + list( + family = NULL, + face = NULL, + colour = "grey10", + size = structure(0.8, class = "rel"), + hjust = NULL, + vjust = NULL, + angle = NULL, + lineheight = NULL, + margin = structure( + c(4.4, 4.4, 4.4, 4.4), + unit = 8L, + class = c( + "margin", + "simpleUnit", "unit", "unit_v2" + ) + ), + debug = NULL, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ), + strip.text.x = NULL, + strip.text.y = structure( + list( + family = NULL, + face = NULL, + colour = NULL, + size = NULL, + hjust = NULL, + vjust = NULL, + angle = -90, + lineheight = NULL, + margin = NULL, + debug = NULL, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ), + strip.switch.pad.grid = structure( + 2.75, + unit = 8L, + class = c( + "simpleUnit", + "unit", "unit_v2" + ) + ), + strip.switch.pad.wrap = structure( + 2.75, + unit = 8L, + class = c( + "simpleUnit", + "unit", "unit_v2" + ) + ), + strip.text.y.left = structure( + list( + family = NULL, + face = NULL, + colour = NULL, + size = NULL, + hjust = NULL, + vjust = NULL, + angle = 90, + lineheight = NULL, + margin = NULL, + debug = NULL, + inherit.blank = TRUE + ), + class = c( + "element_text", + "element" + ) + ) + ), + class = c("theme", "gg"), + complete = TRUE, + validate = TRUE + ) + ) +})