vignette

parent 433a0ab8
......@@ -28,68 +28,38 @@ Genesys fetches all accession data by data. One can reduce the amount of data fe
- `fetch_accessions(list(taxonomy.genus = c('Musa')), selector = function(x) {list(id = x$id, acceNumb = x$acceNumb, instCode = x$institute$code)`- Fetch only **id**, **acceNumb** and **instCode** for *Musa* data.
# Processing fetched data
Fetched data is provided in
genesysr provides data
musa <- genesysr::fetch_accessions(list(taxonomy.genus = c('Musa')))
dsddsd
Fetched data is provided as a deeply nested list. To flatten such list, we recommend the following procedure:
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```r
require(tidyverse)
musa.flatten <- lapply(musa$content, unlist) #looks good
musa.flatten <- musa.flatten %>% map_df(bind_rows)
```
Let's take a look of all the process:
Vignettes are long form documentation commonly included in packages. Because they are part of the distribution of the package, they need to be as compact as possible. The `html_vignette` output type provides a custom style sheet (and tweaks some options) to ensure that the resulting html is as small as possible. The `html_vignette` format:
- Never uses retina figures
- Has a smaller default figure size
- Uses a custom CSS stylesheet instead of the default Twitter Bootstrap style
## Vignette Info
Note the various macros within the `vignette` section of the metadata block above. These are required in order to instruct R how to build the vignette. Note that you should change the `title` field and the `\VignetteIndexEntry` to match the title of your vignette.
## Styles
## Load genesysr
The `html_vignette` template includes a basic CSS theme. To override this theme you can specify your own CSS in the document metadata as follows:
output:
rmarkdown::html_vignette:
css: mystyles.css
## Figures
The figure sizes have been customised so that you can easily put two images side-by-side.
```{r, fig.show='hold'}
plot(1:10)
plot(10:1)
```r
library(genesysr)
```
You can enable figure captions by `fig_caption: yes` in YAML:
output:
rmarkdown::html_vignette:
fig_caption: yes
Then you can use the chunk option `fig.cap = "Your figure caption."` in **knitr**.
## More Examples
## Setup using credentials
```r
setup_sandbox()
user_login()
```
You can write math expressions, e.g. $Y = X\beta + \epsilon$, footnotes^[A footnote here.], and tables, e.g. using `knitr::kable()`.
## Fetch data
```{r, echo=FALSE, results='asis'}
knitr::kable(head(mtcars, 10))
```r
musa <- genesysr::fetch_accessions(list(taxonomy.genus = c('Musa')))
```
Also a quote using `>`:
## Flatten data into data frame
> "He who gives up [code] safety for [code] speed deserves neither."
([via](https://twitter.com/hadleywickham/status/504368538874703872))
```r
require(tidyverse)
musa.flatten <- lapply(musa$content, unlist) #looks good
musa.flatten <- musa.flatten %>% map_df(bind_rows)
```
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment