Bookdown



Configuración

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)

code codigo

Tablas

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

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

::: {#refs}
:::

Citar paquetes

if(!file.exists("files/pkgs.bib")){write_bib(c(.packages()),'files/pkgs.bib')}

PDF’s

<embed src="files/file_name.pdf" width="100%" height="500" alt="pdf" pluginspage="http://www.adobe.com/products/acrobat/readstep2.html">

Videos

<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>

Articul8

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

#> 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