Skip to content

Instantly share code, notes, and snippets.

@kleinlennart
Last active January 29, 2024 09:23
Show Gist options
  • Save kleinlennart/9b2a6fe4939cacb895375afe7c5ce06d to your computer and use it in GitHub Desktop.
Save kleinlennart/9b2a6fe4939cacb895375afe7c5ce06d to your computer and use it in GitHub Desktop.
.Rprofile
if (interactive()) {
suppressMessages(require(usethis))
}
if (interactive()) {
suppressMessages(require(devtools))
}
if (interactive()) {
suppressMessages(require(cput))
}
if (interactive()) {
use_folders <- function(...) {
cli::cli_alert_success("Creating subfolders...")
usethis::use_directory("R")
usethis::use_directory("data")
usethis::use_directory("data/data_raw")
usethis::use_directory("data/plots")
file.create("data/.gitkeep", showWarnings = FALSE)
file.create("plots/.gitkeep", showWarnings = FALSE)
# purrr::walk(folders, function(folder) {
# dir.create(folder, showWarnings = FALSE)
# file.create(paste0(folder, "/.gitkeep"), showWarnings = FALSE)
# })
usethis::write_union(usethis::proj_path(".", ".gitignore"), c("data/*", "!data/.gitkeep"))
}
}
if (interactive()) {
use_more_ignores <- function(...) {
ignores <- c("*_cache/")
usethis::use_git_ignore(ignores)
}
}
if (interactive()) {
use_ignore_template <- function(template_name = "r", ...) {
new_lines <- gitignore::gi_fetch_templates(template_name = template_name)
gitignore::gi_write_gitignore(fetched_template = new_lines, gitignore_file = usethis::proj_path(".", ".gitignore"))
}
}
options(styler.cache_root = "styler-perm")
# clean up with styler::cache_clear()
googlesheets4::gs4_auth("lennart.s.klein@gmail.com")
## Conflict resolution
# conflicted::conflicts_prefer(.quiet = TRUE,
# dplyr::filter,
# dplyr::lag,
# dplyr::select
# )
# https://cli.r-lib.org/
# https://cli.r-lib.org/reference/inline-markup.html
# https://cli.r-lib.org/reference/links.html
# cli::cli_alert_warning("Remember to run {.run usethis::use_git()} early on.")
if (interactive()) {
cli::cli_alert_warning("Pull early, commit often.")
}
# Overwrite Functions --------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment