Skip to content

Instantly share code, notes, and snippets.

View maelle's full-sized avatar

Maëlle Salmon maelle

View GitHub Profile
com <- git2r::commits() |> purrr::map_chr("message") |> tolower()
n_feat <- com |>
grepl("^feat", .) |>
sum()
n_fix <- com |>
grepl("^fix", .) |>
sum()
@gaborcsardi
gaborcsardi / Pkgdown deploy from Travis.md
Last active November 17, 2021 13:41
Walkthrough: deploy a pkgdown site from Travis

Run usethis::use_pkgdown_travis()

usethis::use_pkgdown_travis()
✔ Setting active project to '/Users/gaborcsardi/works/ps'Adding 'docs/' to '.gitignore'Set up deploy keys by running `travis::use_travis_deploy()`Insert the following code in '.travis.yml'
  before_cache: Rscript -e 'remotes::install_cran("pkgdown")'
@zross
zross / scrape_spatial.R
Created April 30, 2019 13:03
For getting download counts for spatial packages
# Grab the list of spatial packages from the R Task View (Bivand)
# and get the count of monthly downloads
library(rvest)
library(dplyr)
spatial_task_view <- read_html("https://cran.r-project.org/web/views/Spatial.html")
res <- spatial_task_view %>%
html_nodes(xpath = "/html/body/ul[1]") %>%
html_children() %>%
@nuest
nuest / switching-from-XML-to-xml2.md
Last active March 6, 2024 17:07
Switching an R package from XML to xml2

Switching from XML to xml2

Rationale

The R package XML for parsing and manipulation of XML documents in R is not actively maintained anymore, but used by many:

The R package xml2 is an actively maintained, more recent alternative.

This file documents useful resources and steps for moving from XML to xml2.

@peterdesmet
peterdesmet / CONTRIBUTING.md
Last active February 10, 2021 17:34
My CONTRIBUTING.md template for R packages. Released under CC0, so replace our_package, our_org, and maintainer_email and adapt as you see fit. 😌 For more info, see https://help.github.com/articles/setting-guidelines-for-repository-contributors

Contributing to our_package

First of all, thanks for considering contributing to our_package! 👍 It's people like you that make it rewarding for us - the project maintainers - to work on our_package. 😊

our_package is an open source project, maintained by people who care. We are not directly funded to do so.

@nwellnhof
nwellnhof / xml2md.xsl
Last active September 2, 2018 17:02
Transform the cmark XML format back to Commonmark
<?xml version="1.0" encoding="UTF-8"?>
<!--
xml2md.xsl
==========
This XSLT stylesheet transforms the cmark XML format back to Commonmark.
Since the XML output is lossy, a lossless MD->XML->MD roundtrip isn't
possible. The XML->MD->XML roundtrip should produce the original XML,
@HanjoStudy
HanjoStudy / useR2018.md
Last active November 10, 2023 02:07
useR2018 Material

I am looking forward to meeting you at the Tuesday AM (10th of July) tutorial session at useR2018!. We will be discussing a subject that I am very passionate about: Web Scraping!

The slides can be found here:

To ensure that we can be immediately productive on Tuesday morning, I would like you to get the following set up on your machines beforehand:

install.packages("rnoaa")
library(rnoaa)
ids <- c("ASN00095063", "ASN00024025", "ASN00040112", "ASN00041023",
         "ASN00009998", "ASN00066078", "ASN00003069", "ASN00090162",
         "ASN00040126", "ASN00058161")
meteo_pull_monitors(monitors, var = c('prcp', 'tmax', 'tmin'))
@jimhester
jimhester / create_flashcards.R
Last active May 20, 2018 13:23
Create flash cards of rOpenSci unconf participants. You can get the shared deck from https://ankiweb.net/shared/info/806702790 or by importing the 'unconf 2018.apkg' file in this gist
# On macOS Anki media files are stored in ~/Library/Application Support/Anki2/Username/collection.media/
# https://apps.ankiweb.net/docs/manual.html#file-locations
# get images from Unconf repo, resize them and write them to the new path
# Code assumes it is being run on macOS from the checkout of the conference repo, e.g. `git clone https://github.com/ropensci/unconf18 && cd unconf18`
library(fs)
library(magick)
imgs <- dir_ls("images/participants")
for (f in imgs) {
f %>%
image_read() %>%