Created
May 16, 2022 11:58
-
-
Save wjhopper/fd09de8444531378d99c0c08c7b1f909 to your computer and use it in GitHub Desktop.
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
if (.Platform$OS.type == "windows") { | |
folder <- file.path(Sys.getenv("AppData"), "RStudio", "templates") | |
} else { | |
folder <- "~/.config/rstudio/templates" | |
} | |
if (!dir.exists(folder)) { dir.create(folder, recursive = TRUE) } | |
f <- file(file.path(folder, "default.Rmd") ,"wt") | |
template_text <- '--- | |
title: "Your Title" | |
author: "Your Name" | |
output: | |
pdf_document: | |
latex_engine: xelatex | |
html_document: default | |
---' | |
writeLines(template_text, con = f) | |
close(f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment