Skip to content

Instantly share code, notes, and snippets.

View DanChaltiel's full-sized avatar

Dan Chaltiel DanChaltiel

View GitHub Profile
@DanChaltiel
DanChaltiel / read_nquery.R
Last active March 16, 2022 11:23
Read nQuery file
if(!require(tidyverse) || !require(xml2)){
stop("Packages `tidyverse` and `xml2` are required for read_nquery() to work.\n",
'Please run `install.packages(c("tidyverse", "xml2", "devtools"))` before trying again.')
}
#' Read nQuery files
#'
#' @param file the `.nqt` file
@DanChaltiel
DanChaltiel / pagebreaks.lua
Created December 30, 2019 10:59
An RMarkdown pandoc filter for MS Word docx output
-- Extension ofTarleb's answer on Stackoverflow (https://stackoverflow.com/a/52131435/3888000) to include docx section ends with portrait/landscape orientation changes.
-- Also uses officer package syntax to create sections breaks
local function newpage(format)
if format == 'docx' then
local pagebreak = '<w:p><w:r><w:br w:type="page"/></w:r></w:p>'
return pandoc.RawBlock('openxml', pagebreak)
else
return pandoc.Para{pandoc.Str '\f'}