Title: | For Writing Geneva Graduate Institute Documents |
---|---|
Description: | A set of tools for writing documents according to Geneva Graduate Institute conventions and regulations. The most common use is for writing and compiling theses or thesis chapters, as drafts or for examination with correct preamble formatting. However, the package also offers users to create HTML presentation slides with 'xaringan', complete problem sets, format posters, and, for course instructors, prepare a syllabus. The package includes additional functions for institutional color palettes, an institutional 'ggplot' theme, a function for counting manuscript words, and a bibliographical analysis toolkit. |
Authors: | James Hollway [aut, cre, cph] |
Maintainer: | James Hollway <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.9.7 |
Built: | 2025-03-12 05:33:32 UTC |
Source: | https://github.com/iheid-library/iheiddown |
This function takes a start date, e.g. of a course, and advances it by a number of weeks. This function is used in the syllabus template.
advdate(startdate, week)
advdate(startdate, week)
startdate |
The first date in the series (e.g. first day of class). |
week |
The number of weeks into the series. Week 1 is the first date in the series. |
A vector of dates in the format "dd mmm" in parentheses.
advdate("2021-06-23", 1:3)
advdate("2021-06-23", 1:3)
These functions are useful for calculating salient statistics on the bibliographies used for dissertations or syllabi. They include the following functions/metrics:
percent_female(bib_file, rmd_file, by = c("author", "publication")) mean_year(bib_file, rmd_file) mean_pages(bib_file, rmd_file) total_pages(bib_file, rmd_file)
percent_female(bib_file, rmd_file, by = c("author", "publication")) mean_year(bib_file, rmd_file) mean_pages(bib_file, rmd_file) total_pages(bib_file, rmd_file)
bib_file |
A .bib file for the project. If not given, the functions will search for a .bib file in the folder associated with the file the source editor has open. |
rmd_file |
A .rmd file If not given, the functions will check to see whether the current file open in the source editor is an .rmd file, and if so use that. |
by |
A string in c("author", "publication") which determines if the percentage of female authors is computed across all papers or the percentage represents the proportion of papers written by at least one woman. |
percent_female()
Displays the percentage of authors in a
.bib
file that are female. See the {gender}
package for more details.
mean_year()
Displays the average year of publication of the items
in a given .bib
file.
mean_pages()
Displays the average number of pages of the items
in a given .bib
file.
total_pages()
Displays the total number of pages of all items
in a given .bib
file.
Prints a summary statistic (e.g. mean or proportion)
This RStudio Addin opens up the ~/_bookdown.yml file for users to edit. If the file doesn't exists, it will create one.
bookdown_profile()
bookdown_profile()
Opens or creates a bookdown profile YAML file for the current thesis.
This function can be used in the header of each constituent chapter of an IHEID thesis to output a draft version of the chapter for proofreading or sending to your supervisor.
chapter_pdf(input, ...)
chapter_pdf(input, ...)
input |
Rmd input file that will be processed by the function. |
... |
Instructions passed to the function from a correctly specified .Rmd document |
A modified pdf_document
based on the IHEID Thesis LaTeX
template
## Not run: knit: iheiddown::chapter_pdf ## End(Not run)
## Not run: knit: iheiddown::chapter_pdf ## End(Not run)
This function takes a path to a .Rmd file and returns a word count. For best results each sentence should start on a new line. Inline code chunks should also start on a new line.
count_words(file) count_words2(file)
count_words(file) count_words2(file)
file |
A path to a .Rmd file |
A scalar representing the number of words in the document.
rmarkdown::draft(file = "test", template = "html_vignette", package = "rmarkdown", create_dir = TRUE, edit = FALSE) iheiddown::count_words("test/test.Rmd") unlink("test", recursive = TRUE)
rmarkdown::draft(file = "test", template = "html_vignette", package = "rmarkdown", create_dir = TRUE, edit = FALSE) iheiddown::count_words("test/test.Rmd") unlink("test", recursive = TRUE)
These are a few color palettes useful for members of the Geneva Graduate Institute.
This function calls one of three official palettes in
iheid_palette
: for the Institute, for the Centres, and for the
SDGs.
iheid_palette(name, n, type = c("discrete", "continuous"))
iheid_palette(name, n, type = c("discrete", "continuous"))
name |
Name of desired palette. Current choices are:
|
n |
Number of colors desired. If omitted, uses all colours. |
type |
Either "continuous" or "discrete". Use continuous if you want to automatically interpolate between colours. |
A vector of colours.
Adapted from https://github.com/karthik/wesanderson/blob/master/R/colors.R
iheid_palette("IHEID") iheid_palette("Centres") iheid_palette("SDGs") # If you need more colours than normally found in a palette, you # can use a continuous palette to interpolate between existing # colours pal <- iheid_palette(21, name = "Centres", type = "continuous") image(volcano, col = pal)
iheid_palette("IHEID") iheid_palette("Centres") iheid_palette("SDGs") # If you need more colours than normally found in a palette, you # can use a continuous palette to interpolate between existing # colours pal <- iheid_palette(21, name = "Centres", type = "continuous") image(volcano, col = pal)
Use iheid_palette
to construct palettes of desired length.
iheid_palettes
iheid_palettes
An object of class list
of length 3.
These functions render different versions of the original {posterdown}
templates with a little IHEID twist to them. All exports are in HTML format.
You can save them by printing them to PDF via a modern browser.
The output format poster_betterland()
mimics the style of the
BetterPoster movement from twitter with an IHEID twist.
The output format poster_betterport()
mimics the style of the
BetterPoster movement from twitter with an IHEID twist.
iheiddown_poster( ..., template = system.file("rmarkdown", "templates", "iheiddown_poster", "resources", "template.html", package = "iheiddown"), css = NULL ) iheiddown_betterland( ..., template = system.file("rmarkdown", "templates", "iheiddown_betterland", "resources", "template.html", package = "iheiddown"), css = NULL ) iheiddown_betterport( ..., template = system.file("rmarkdown", "templates", "iheiddown_betterport", "resources", "template.html", package = "iheiddown"), css = NULL )
iheiddown_poster( ..., template = system.file("rmarkdown", "templates", "iheiddown_poster", "resources", "template.html", package = "iheiddown"), css = NULL ) iheiddown_betterland( ..., template = system.file("rmarkdown", "templates", "iheiddown_betterland", "resources", "template.html", package = "iheiddown"), css = NULL ) iheiddown_betterport( ..., template = system.file("rmarkdown", "templates", "iheiddown_betterport", "resources", "template.html", package = "iheiddown"), css = NULL )
... |
Additional arguments to |
template |
Additional argument passed to |
css |
Additional argument passed to |
R Markdown output format to pass to
rmarkdown::render()
## Not run: file <- file.path(tempdir(),"foo.rmd") rmarkdown::draft(file, template="iheiddown_poster", package="iheiddown") ## End(Not run)
## Not run: file <- file.path(tempdir(),"foo.rmd") rmarkdown::draft(file, template="iheiddown_poster", package="iheiddown") ## End(Not run)
Use the servr package to continuously serve and reload
the Rmd document. Run preview_start()
function while viewing the Rmd
panel of your presentation. To stop the server, run preview_stop()
.
preview_start(file_path, ...) preview_stop(which = NULL)
preview_start(file_path, ...) preview_stop(which = NULL)
file_path |
The input Rmd file path (if missing and in RStudio, the current active document is used). |
... |
Additional arguments passed to
|
which |
An integer vector of the server IDs;
by default, IDs of all existing servers in the current R session obtained
from |
Starts serving the current files to RStudio's Viewer pane.
Stops serving the current files to RStudio's Viewer pane.
xaringan
This is a function called in output in the YAML of the driver Rmd file to specify using the IHEID Problem Set LaTeX template file.
problemset_pdf(input, ...)
problemset_pdf(input, ...)
input |
The name of the .Rmd file to serve as input. |
... |
Instructions passed to the function from a correctly specified .Rmd document |
A modified pdf_document
based on the IHEID Problem Set LaTeX
template, automatically named by course and date.
## Not run: output: iheiddown::problemset_pdf: input: "Untitled.Rmd" # Replace with whatever the name of this file is, e.g. "MINT001.Rmd" ## End(Not run)
## Not run: output: iheiddown::problemset_pdf: input: "Untitled.Rmd" # Replace with whatever the name of this file is, e.g. "MINT001.Rmd" ## End(Not run)
This is a function called in output in the YAML of the driver Rmd file to specify using the IHEID Syllabus LaTeX template file.
syllabus_pdf(input, ...)
syllabus_pdf(input, ...)
input |
The name of the .Rmd file to serve as input. |
... |
Instructions passed to the function from a correctly specified .Rmd document |
A modified pdf_document
based on the IHEID Syllabus LaTeX
template, automatically named by course and date.
## Not run: output: iheiddown::syllabus_pdf: input: "Untitled.Rmd" # Replace with whatever the name of this file is, e.g. "MINT001.Rmd" ## End(Not run)
## Not run: output: iheiddown::syllabus_pdf: input: "Untitled.Rmd" # Replace with whatever the name of this file is, e.g. "MINT001.Rmd" ## End(Not run)
A ggplot2 theme for IHEID style plots. Adapted from Hrbrmstr's ipsum theme.
theme_iheid( base_family = "sans", base_size = 11.5, plot_title_family = base_family, plot_title_size = 18, plot_title_face = "bold", plot_title_margin = 10, subtitle_family = base_family, subtitle_size = 12, subtitle_face = "plain", subtitle_margin = 15, strip_text_family = base_family, strip_text_size = 12, strip_text_face = "plain", caption_family = base_family, caption_size = 9, caption_face = "italic", caption_margin = 10, axis_text_size = base_size, axis_title_family = subtitle_family, axis_title_size = 9, axis_title_face = "plain", axis_title_just = "rt", plot_margin = margin(30, 30, 30, 30), grid_col = "grey85", grid = TRUE, axis_col = iheid_palette("IHEID")["IHEIDBlack"], axis = FALSE, ticks = FALSE )
theme_iheid( base_family = "sans", base_size = 11.5, plot_title_family = base_family, plot_title_size = 18, plot_title_face = "bold", plot_title_margin = 10, subtitle_family = base_family, subtitle_size = 12, subtitle_face = "plain", subtitle_margin = 15, strip_text_family = base_family, strip_text_size = 12, strip_text_face = "plain", caption_family = base_family, caption_size = 9, caption_face = "italic", caption_margin = 10, axis_text_size = base_size, axis_title_family = subtitle_family, axis_title_size = 9, axis_title_face = "plain", axis_title_just = "rt", plot_margin = margin(30, 30, 30, 30), grid_col = "grey85", grid = TRUE, axis_col = iheid_palette("IHEID")["IHEIDBlack"], axis = FALSE, ticks = FALSE )
base_family , base_size
|
base font family and size |
plot_title_family , plot_title_face , plot_title_size , plot_title_margin
|
plot title family, face, size and margi |
subtitle_family , subtitle_face , subtitle_size
|
plot subtitle family, face and size |
subtitle_margin |
plot subtitle margin bottom (single numeric value) |
strip_text_family , strip_text_face , strip_text_size
|
facet label font family, face and size |
caption_family , caption_face , caption_size , caption_margin
|
plot caption family, face, size and margin |
axis_text_size |
font size of axis text |
axis_title_family , axis_title_face , axis_title_size
|
axis title font family, face and size |
axis_title_just |
axis title font justification, one of |
plot_margin |
plot margin (specify with |
grid_col , axis_col
|
grid & axis colors; both default to |
grid |
panel grid ( |
axis |
add x or y axes? |
ticks |
ticks if |
Themes the current ggplot to current IHEID guidelines.
library(ggplot2) library(dplyr) # seminal scatterplot ggplot(mtcars, aes(mpg, wt)) + geom_point() + labs(x="Fuel efficiency (mpg)", y="Weight (tons)", title="Seminal ggplot2 scatterplot example", subtitle="A plot that is only useful for demonstration purposes", caption="Brought to you by the letter 'g'") + theme_iheid() # seminal bar chart count(mpg, class) %>% ggplot(aes(class, n)) + geom_col() + geom_text(aes(label=n), nudge_y=3) + labs(x="Fuel efficiency (mpg)", y="Weight (tons)", title="Seminal ggplot2 bar chart example", subtitle="A plot that is only useful for demonstration purposes", caption="Brought to you by the letter 'g'") + theme_iheid(grid="Y") + theme(axis.text.y=element_blank())
library(ggplot2) library(dplyr) # seminal scatterplot ggplot(mtcars, aes(mpg, wt)) + geom_point() + labs(x="Fuel efficiency (mpg)", y="Weight (tons)", title="Seminal ggplot2 scatterplot example", subtitle="A plot that is only useful for demonstration purposes", caption="Brought to you by the letter 'g'") + theme_iheid() # seminal bar chart count(mpg, class) %>% ggplot(aes(class, n)) + geom_col() + geom_text(aes(label=n), nudge_y=3) + labs(x="Fuel efficiency (mpg)", y="Weight (tons)", title="Seminal ggplot2 bar chart example", subtitle="A plot that is only useful for demonstration purposes", caption="Brought to you by the letter 'g'") + theme_iheid(grid="Y") + theme(axis.text.y=element_blank())
This is a function called in output in the YAML of the driver Rmd file to specify using the IHEID Thesis LaTeX template file.
thesis_pdf(input = ".", ...)
thesis_pdf(input = ".", ...)
input |
Rmd input file that will be processed by the function. |
... |
Instructions passed to the function from a correctly specified .Rmd document |
A modified pdf_document
based on the IHEID Thesis LaTeX
template
## Not run: knit: iheiddown::thesis_pdf ## End(Not run)
## Not run: knit: iheiddown::thesis_pdf ## End(Not run)