---
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}
tab <- gs %>% 
  range_read("prosopis") %>% 
  select(rep:D5) %>% 
  head(10) %>% 
  inti::info_table(
    caption = "Germination dataset import from a googlesheet"
    , notes = "@schafleitner2007")  
tab %>%  inti::include_table()

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

### Figuras

```{r, eval = F}
gerplot <- cowplot::plot_grid(gbp, ggt
                              , nrow = 1
                              , labels = "AUTO")
save_plot("files/fig_gerplot.png", 
          plot = gerplot,
          dpi= 300, 
          base_height = 100, 
          base_aspect_ratio = 2.5, 
          units = "mm")
fig <- info_figure(
  caption = "Germination  experiment with *Prosopis juliflor* under different osmotic potentials and temperatures."
  , notes = "A) Bar graph with germination percentage in a factorial analisys. B)  Line graph from cumulative germination under different osmotic potentials."
  , label = "__Where:__"
  , url = "files/fig_gerplot.png"
  )
  
fig %>% include_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, "manuscript.Rmd")

#> title: &nbsp
#> include=FALSE
#> child = "manuscript.Rmd"
#> unlink("manuscript.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  

```



