From 492d9c99350acb4584dff9fb8602dd3c4dfe061c Mon Sep 17 00:00:00 2001 From: Lorena Pantano Date: Mon, 29 Apr 2024 17:16:10 -0400 Subject: [PATCH] add vignette --- .gitignore | 3 ++- DESCRIPTION | 4 +++ NAMESPACE | 1 + R/bcbioR-package.R | 1 + README.Rmd | 4 +++ README.md | 5 ++++ man/hello.Rd | 12 --------- vignettes/.gitignore | 2 ++ vignettes/bcbioR_quick_start.Rmd | 44 ++++++++++++++++++++++++++++++++ 9 files changed, 63 insertions(+), 13 deletions(-) delete mode 100644 man/hello.Rd create mode 100644 vignettes/.gitignore create mode 100644 vignettes/bcbioR_quick_start.Rmd diff --git a/.gitignore b/.gitignore index 7ae9725..6e74615 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ *.Rproj test/* inst/*/*/*/*/*/*html -inst/*/*/*/*/*/*csv \ No newline at end of file +inst/*/*/*/*/*/*csv +inst/doc diff --git a/DESCRIPTION b/DESCRIPTION index 70ed6df..975ef50 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -14,3 +14,7 @@ Imports: stringr, ggplot2, magrittr +Suggests: + knitr, + rmarkdown +VignetteBuilder: knitr diff --git a/NAMESPACE b/NAMESPACE index dafe89b..eb74e87 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -10,5 +10,6 @@ export(list_cb_friendly_cols) export(scale_color_cb_friendly) export(scale_fill_cb_friendly) import(ggplot2) +import(hues) importFrom(magrittr,"%>%") importFrom(stringr,str_replace_all) diff --git a/R/bcbioR-package.R b/R/bcbioR-package.R index 611ed90..620ae89 100644 --- a/R/bcbioR-package.R +++ b/R/bcbioR-package.R @@ -6,4 +6,5 @@ #' @importFrom stringr str_replace_all ## usethis namespace: end #' @import ggplot2 +#' @import hues NULL diff --git a/README.Rmd b/README.Rmd index 5b30416..b673c36 100644 --- a/README.Rmd +++ b/README.Rmd @@ -46,6 +46,10 @@ This code will populate the folder with HCBC data structure guidelines and Rmd c bcbio_templates(type="rnaseq", outpath="test_folder/reports") ``` +### Discover more + +Go to the vignette to know more `vignette("bcbioR_quick_start,package="bcbioR")` + ## How to Contribute You'll still need to render `README.Rmd` regularly, to keep `README.md` up-to-date. `devtools::build_readme()` is handy for this. diff --git a/README.md b/README.md index df83c75..1ebc661 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,11 @@ and Rmd code: bcbio_templates(type="rnaseq", outpath="test_folder/reports") ``` +### Discover more + +Go to the vignette to know more +`vignette("bcbioR_quick_start,package="bcbioR")` + ## How to Contribute You’ll still need to render `README.Rmd` regularly, to keep `README.md` diff --git a/man/hello.Rd b/man/hello.Rd deleted file mode 100644 index 0fa7c4b..0000000 --- a/man/hello.Rd +++ /dev/null @@ -1,12 +0,0 @@ -\name{hello} -\alias{hello} -\title{Hello, World!} -\usage{ -hello() -} -\description{ -Prints 'Hello, world!'. -} -\examples{ -hello() -} diff --git a/vignettes/.gitignore b/vignettes/.gitignore new file mode 100644 index 0000000..097b241 --- /dev/null +++ b/vignettes/.gitignore @@ -0,0 +1,2 @@ +*.html +*.R diff --git a/vignettes/bcbioR_quick_start.Rmd b/vignettes/bcbioR_quick_start.Rmd new file mode 100644 index 0000000..072ee90 --- /dev/null +++ b/vignettes/bcbioR_quick_start.Rmd @@ -0,0 +1,44 @@ +--- +title: "bcbioR quick start" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Quick_Start} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +```{r setup} +library(bcbioR) +library(ggplot2) +``` + +# Color blind friendly palette + +Compatible with `ggplot`. + +```{r} +set.seed(596) +dsamp <- diamonds[sample(nrow(diamonds), 1000), ] +(d <- ggplot(dsamp, aes(carat, price)) + + geom_point(aes(colour = clarity))) +d + scale_color_cb_friendly() +``` + + +And get the colors directly: + +```{r} +cb_friendly_cols(1:16) +``` +```{r} +library(hues) +swatch(cb_friendly_cols(1:16)) +``` +