Skip to content

Instantly share code, notes, and snippets.

View maurolepore's full-sized avatar

Mauro Lepore maurolepore

View GitHub Profile
# source("https://bit.ly/use_pin")
library(pins)
use_pin <- function(x, name, board = board_local(), overwrite = FALSE) {
if (!pin_exists(board, name) || overwrite) pin_write(board, x, name)
pin_read(board, name)
}
library(dplyr)
library(rvest)
library(chromote) # remotes::install_github("rstudio/chromote")
library(countrycode)
library(readr)
# ------------------------------------------------------------------------------
em_url <- "https://www.europages.co.uk/DAZUN-GMBH/00000005340662-639906001.html"
# https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/delayedAssign

# The code of any pkg, e.g. r2dii.data -----------------------------------------
# R/abcd_demo.R
abcd_demo <- head(mtcars)
delayedAssign("ald_demo", {
  warning("`ald_demo` is retired. Instead use `abcd_demo`")
  abcd_demo
})

Here: https://bit.ly/3KuXgpE

--

On my local machine

url <- "https://esastar-emr.sso.esa.int/PublicEntityDir/PublicEntityDirGridSme?term=&isForRegister=False&isForEmits=True&grid-page=3"
jsonlite::fromJSON(url)
#&gt; Error in open.connection(con, "rb"): SSL certificate problem: unable to get local issuer certificate

dsi-checklist

https://bit.ly/dsi-checklist

-2h

  • Announce on #coding.
  • Add meetup date, title and link to the invitation on 2dii's calendar.

-10' before

Here: https://git.io/JXbat

--

library(fs)

path <- fs::path_home("tmp", "inputs", "Loans_results_company.rda")
file_exists(path)
#> /home/mauro/tmp/inputs/Loans_results_company.rda 
library(B)

"/path/to/inputs" %>%
  list.files() %>%
  st_read() %>%
  st_prep_loans() %>%
  st_compute_results("loans") %>%
  st_show_logs() %>%
 st_write("/path/to/output")
library(A)

input_path_project_specific <- "/home/me/path/a"
input_path_project_agnostic <- "/home/me/path/b"
output_path <- "/home/me/path/c"

run_prep_calculation_loans(
  input_path_project_specific,
 input_path_project_agnostic,

Here: https://git.io/JPRtG

# This is how I renamed master to main in all my repos, in bulk on GitHub

library(purrr)
library(glue)
library(gh)

rename_master_to_main &lt;- function(repos, owner) {