The always enthusiastic and knowledgeable mr. @jasaltvik shared with our team an article on writing (good) Git commit messages: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the
This file contains hidden or 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
| fun_labels <- function(x) sprintf("<b>%s</b>", x) | |
| ggplot() + | |
| scale_x(breaks = c('a','b','c')) + | |
| theme(axis.label = element_sticker(grob = fancyGrob, dictionary = fun_labels)) | |
| my_labels <- tibble(label = letters[1:3], grobs = I(lapply(1:3, fancyGrob))) |
This file contains hidden or 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
| # install.packages(c("here", "fs", "stringr", "purrr", "git2r")) | |
| # to add invisibly in your R profile, open with usethis::edit_r_profile() | |
| # then define it in an environment, e.g. | |
| # .env <- new.env() | |
| # .env$move_slides_to_web <- {function definition} | |
| move_slides_to_web <- function(folder = NULL, index = NULL) { | |
| if (is.null(folder)) { |
This file contains hidden or 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
| using JuMP, GLPK | |
| function graph_coloring(;fast=true, benchmark=false) | |
| m = Model(with_optimizer(GLPK.Optimizer, msg_lev = 3)) | |
| @variable(m, max_color, Int) | |
| @variable(m, c[1:49,1:4], Bin) | |
| @objective(m, Min, max_color) |
This gist is no longer going to be updated. Instead, check out the page at https://rmflight.github.io/rerrors/, or the GitHub project itself at https://rmflight.github.io/rerrors/
You don't need to do 'install.packages("tidyverse")' every time. Install is installing it on your system. You only need to do it again if you re-install R, or want a newer version. 'library()' loads it for use, and 'install.packages()' installs it to your computer.
Error in instal.packages("tidyverse") : could not find function "instal.packages
This file contains hidden or 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
| # Install and load required packages | |
| install.packages("needs") | |
| library(needs) | |
| needs(tidyverse, magrittr, animation, pdftools, png, scales) | |
| # Function that extracts data from Google Mobility PDFs | |
| process_google_mobility <- function(country_code, start_date, end_date){ | |
| # Convert first page of PDF into high-res PNG | |
| pdf_convert(paste0("https://www.gstatic.com/covid19/mobility/",end_date,"_",country_code,"_Mobility_Report_en.pdf"), format = "png", pages = 1, dpi = 300, filenames = "IMG1.png") |
This file contains hidden or 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
| mutate2 <- function(.data, ...) { | |
| dots <- rlang::enquos(...) | |
| has_tilde_lgl <- sapply(dots, function(x) { | |
| expr <- rlang::quo_get_expr(x) | |
| is.call(expr) && identical(expr[[1]], quote(`~`)) | |
| }) | |
| inds <- which(has_tilde_lgl) | |
| nms <- names(dots)[inds] | |
| exprs <- vector("list", length(inds)) | |
| for(i in seq_along(inds)) { |
OlderNewer