This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Creating PDF exam | |
# Write questions as Rmd, use latex symbols instead of HTML | |
# get files as list. Could pool questions as well. | |
questions <- as.list(list.files("<location>", pattern = "*.Rmd", full.names = TRUE)) | |
exams::exams2pdf(qs, | |
# list of questions | |
n = 2, | |
# Number of unique copies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\begin{coverpages} | |
\begin{center} | |
% provide instructions and details | |
\fbox{\fbox{\parbox{5.5in}{\centering | |
Answer the questions in the spaces provided on the question sheets. \linebreak | |
If you run out of room for an answer, continue on the back of the page.}}} | |
\end{center} | |
\vspace{1in} | |
\makebox[0.9\textwidth]{Name:\enspace\hrulefill} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For generating unique column names using a custon function for behaviours outside default name_repair options or make.unique | |
# tibble has duplicated column names (a, b), stop error without name repair | |
tibble::tibble(a = letters[1:5], b = LETTERS[1:5], a = letters[1:5], b = LETTERS[1:5], | |
.name_repair = function (x) ave(x, x, FUN = function(i) stringr::str_c(i, '_', seq_along(i)))) | |
# str_c appends suffix in form "_1", "_2", "_i" for each duplicated columns grouped as indicated by ave; across all columns | |
# output: a_1, b_1, a_2, b_2 | |
# Works for any tidyverse tibble that takes .name_repair, e.g. expand_grid for generating pairwise tables | |
# Can use paste0 instead of str_c |