- Thesis and articles template
- Export word and html document
- Word improved template
- Bibliography citation
- R workflow for data analysis
- Scientific graphic quality
Example: https://flavjack.github.io/rticles/
It is recommended install and create an account if is needed for the following apps, all are free and can be complemented with reproducible research.
- R https://cran.rstudio.com/
- Rstudio https://rstudio.com/products/rstudio/download/
- Git https://git-scm.com/
- Zotero https://www.zotero.org/download/
- Google account: Gsuit
- You can use "rticles" as template from GitHub: https://github.com/Flavjack/rticles
or
- You can clone the "rticles" repository using the terminal in Rstudio, for windows user using bash (install Git)
bash
prj="project_name"
info="project info"
gituser="Flavjack"
repo="https://github.com/Flavjack/rticles"
cd
mkdir git
cd git
git clone $repo.git $prj
cd $prj
mv 'rticles.Rproj' $prj.Rproj
curl -u $gituser https://api.github.com/user/repos -d "{\"name\":\"$prj\", \"description\": \"$info\", \"private\": \"true\"}"
git remote rm origin
git commit -m "starting rticles"
git remote add origin https://github.com/$gituser/$prj.git
git push -u origin master
open $prj.Rproj
open .
-
Run the first chunk in the "index.Rmd" called "setup" and all the packages will be installed automatically.
-
If all packages are installed correctly shoul be appear the "Build" button in the Rstudio IDE (Integrated Development Environment).
-
Play the "Build" button and wait until compile the document and if all is okay pop-up window will be appeare with the html version of the document.
-
You can modify the document changing the text and code in the "index.Rmd" file.
-
Now you are ready to go and produce your first document!
Type | Name | Removable | Description |
---|---|---|---|
folder | cnfg | NO | Contains all document settings. |
file | index.Rmd | NO | File that produce the article (code/figures/tables). |
file | rticle.Rproj | NO | Rename the file according your repository name. |
file | .gitignore | NO | System options. |
file | _bookdown.yml | YES | Options to compile the document. |
file | _output.yml | YES | html options for the web page. |
file | README.rmd | YES | It is the repository description! |
folder | files | YES | Images and files that are included in the document. |
folder | docs | YES | Files for deploy the web page using github pages). |
The document is building with Lorem Ipsum text, and the dataset, examples and tables used are from GerminaR
package.
The dataset is a germination data example* with a completely randomized design with four replications per treatment under laboratory conditions. The first factor corresponds to five levels of sodium chloride (NaCl) (0, 0.5, 1.0, 1.5 and 2 MPa), and the second factor corresponds to four levels of temperature (25°C, 30°C, 35°C and 40°C).
*Lozano-Isla, Flavio, Omar E. Benites-Alfaro, and Marcelo F. Pompelli, ‘GerminaR: An R Package for Germination Analysis with the Interactive Web Application “GerminaQuant for R”’, Ecological Research, 34.2 (2019), 339–46 https://doi.org/10.1111/1440-1703.1275
title: |-
Universidad Nacional
Facultad de
Carrera Profesional de
`r if (!knitr:::is_html_output()) knitr::include_graphics('cnfg/icons/logo.png')`
subtitle: |-
__________________________________________________________
TITLE
__________________________________________________________
*Tesis para Optar el Título *
author: "Nombres y Apelidos"
date: |-
`r if (knitr:::is_html_output()) {format(Sys.time(), '%d %b %Y %X')}`
Lugar-País
2020
`r if (knitr:::is_html_output()) '# Figures'`
`r if (!knitr:::is_html_output()) '# Figures'`
<!-- caution - important - note - tip - warning -->
Texto!
# Cita textual
@CiteKey
# Cita contextual
[@CiteKey]
# Fonts
**negrita**
*italica*
upper^indice^
sub~indice~
# Page
# Salto de página
\newpage
# Linea horizonatal
***
source("cnfg/setup.r")
sheets_auth(T)
url <- "googlehseet_url"
gs <- as_sheets_id(url)
# browseURL(url)
xl <- gs %>% drive_download("files/fieldbook.xlsx", overwrite = T) %>% pluck(2)
fb <- xl %>% readxl::read_excel("fb")
Create a Gsheet with tabname "fig". The tab should be 3 colums:
- figure: name to identify the figure ("chunk_name")
- description: title caption
- url: image url
fig <- opts_current$get('label')
sheet <- "fig"
title <- xl %>%
read_excel(sheet) %>%
filter(figure == fig) %>%
select(description) %>%
as_vector()
xl %>%
read_excel(sheet) %>%
filter(figure == fig) %>%
select(url) %>%
as_vector() %>%
include_graphics()
knitr::opts_knit$set(eval.after = 'fig.cap')
# \@ref(fig:)
Cite figure:
@ref(fig:figure_name)
Create a Gsheet with tabname "tab". The tab should be 3 colums:
- table: tab name with the table ("chunk_name")
- description: title caption
- note: sub title caption
tab <- opts_current$get("label")
sheet <- "tab"
title <- xl %>%
read_excel(sheet) %>%
filter(table == tab) %>%
select(description) %>%
as_vector()
note <- xl %>%
read_excel(sheet) %>%
filter(table == tab) %>%
select(note) %>%
as_vector()
xl %>%
read_excel(tab) %>%
kable(caption = title) %>%
add_footnote(notation = "symbol", label = note)
# \@ref(tab:)
Cite table:
@ref(tab:chunk_name)
`r if (knitr::is_html_output()){'
# References
<div id="refs"></div>'}`
`r if (!knitr::is_html_output()){'
# References
<div id="refs"></div>'}`
<embed src="files/file_name.pdf" width="100%" height="500" alt="pdf" pluginspage="http://www.adobe.com/products/acrobat/readstep2.html">
<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>
# Import changes from origen
git pull
# Push changes to origen
git add .
git commit -m "message"
git push
# re-write local files from origen
git fetch --all
git reset --hard origin/master
git pull origin master
# Force push to origen
git push -f origin master
# Undoing Multiple Commits
git reset --hard <commit>