---
title: "Rticles: cheat sheet"
description: document template for scientific report
output: 
  blogdown::html_page:
    self_contained: true
link-citations: true
colorlinks: yes
# bibliography: [files/book.bib, files/pkgs.bib]
csl: https://www.zotero.org/styles/apa
editor_options: 
  chunk_output_type: console
---

## Bookdown

***
***

### Configuración

```{r, eval = F}
source("https://lozanoisla.com/setup.r")
url <- paste0("https://docs.google.com/spreadsheets/d/"
              , "1QziIXGOwb8cl3GaARJq6Ez6aU7vND_UHKJnFcAKx0VI")
gs <- as_sheets_id(url)
# browseURL(url)
xl <- gs %>% 
  drive_download("files/fieldbook.xlsx", overwrite = T) %>%
  pluck(2)
fb <- xl %>% 
  readxl::read_excel("prosopis")  %>% 
  rename_with(tolower) %>% 
  mutate(across(c("rep", "nacl", "temp"), ~ as.factor(.) )) %>% 
  mutate(across(where(is.factor), ~ gsub("[[:space:]]", "", .)) ) %>% 
  as.data.frame()
# str(fb)
```

```{=html}
<div id="icons" style="width: 100%; margin: auto;">

<div style="display: inline-block; width: 100%;">
<p style="text-align: center;"><a rel="noopener" href="https://raw.githubusercontent.com/Flavjack/rticles/master/index.Rmd" target="_blank"><img style="height: 50px;" title="code" src="https://www.flaticon.es/svg/static/icons/svg/2920/2920244.svg" alt="code" /></a> <span style="display: block;">codigo</span></p>
</div>

</div>
```

### Tablas

```{r, eval = F}
gs %>% 
  range_read("prosopis") %>% 
  select(rep:D5) %>% 
  head(10) %>% 
  inti::include_table(
    caption = "Germination dataset import from a googlesheet"
    , notes = "@schafleitner2007"
    , label = "__Source:__"
    )

#> cite: (Table \@ref(tab:chunk))
```

### Figuras

```{r, eval = F}
fig <- include_figure(
  figure = "files/fig_jcurcas.png"
  , caption = "Plant of *Jatropha curcas*. 
  A) Foliage.
  B) Leaf. 
  C) Fruit.")

fig$figure

#> cite: (Figure \@ref(fig:chunk))
#> caption: fig.cap= fig$caption
```

### Referencias

#### Especificar posición

```{html, eval = F}
::: {#refs}
:::
```

#### Citar paquetes

```{r, eval = F}
if(!file.exists("files/pkgs.bib")){write_bib(c(.packages()),'files/pkgs.bib')}
```

### PDF's

```{r, eval = F}
<embed src="files/file_name.pdf" width="100%" height="500" alt="pdf" pluginspage="http://www.adobe.com/products/acrobat/readstep2.html">
```

### Videos

```{r, eval = F}
<iframe width="100%" height="450" src="https://www.youtube.com/embed/video_id" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
```

### Articul^8^

```{r, eval=F}
file <- list.files(pattern = '*.zip')
unzip(file, overwrite = T)
list <- unzip(file, list = T)$Name
md <- grep("md$", list) 
path <- list[md]
file.rename(path, "gdoc.Rmd")

#> title: &nbsp
#> include=FALSE
#> child = "gdoc.Rmd"
#> unlink("gdoc.Rmd")
```

### Cover page

```{r, eval=FALSE}
#> yaml 

params:
  user:   'Flavio Lozano Isla'
  title:  '" Title"'
  logo:   !r if (!knitr:::is_html_output()) knitr::include_graphics('files/logo.png')
  uni:    'Universidad Nacional Agraria la Molina'
  facu:   'Facultad de Agronomía'
  type:   'Tesis para optar el título de ingeniero Agrónomo'
  date:   !r if (knitr:::is_html_output()) {format(Sys.time(), '%d %b %Y %X')}
  place:  'Lima-Perú'
  year:   '2021'
  
#> Doc body
  
:::{custom-style="uni"} 
`r params$uni` 
:::
:::{custom-style="facu"} 
`r params$facu` 
:::
:::{custom-style="logo"} 
`r params$logo` 
:::
:::{custom-style="title"} 
`r params$title` 
:::
:::{custom-style="type"} 
`r params$type` 
:::
:::{custom-style="user"} 
`r params$user` 
:::
:::{custom-style="place"} 
`r params$place` 
:::
:::{custom-style="year"} 
`r params$year` 
:::

\newpage  

```

