Skip to content

Instantly share code, notes, and snippets.

View maelle's full-sized avatar
💭
I may be slow to respond.

Maëlle Salmon maelle

💭
I may be slow to respond.
View GitHub Profile
@maelle
maelle / update.R
Created August 29, 2018 14:43
How to update headers
``` r
library("magrittr")
homogeneize <- function(path){
path %>%
readLines(encoding = "UTF-8") %>%
blogdown:::split_yaml_body() %>%
.$body %>%
commonmark::markdown_xml(extensions = TRUE) %>%
xml2::read_xml() -> post_xml
@maelle
maelle / myreprex_reprex.md
Created September 28, 2018 18:30
my reprex
@maelle
maelle / .gistr
Created September 28, 2018 18:57
my reprex
gistr
@maelle
maelle / .gistr
Created September 28, 2018 19:03
my reprex
gistr
@maelle
maelle / demo_reprex.md
Created September 29, 2018 14:18
A demo of posting a reprex
{
"packages": [
{
"name": "auk",
"description": "eBird Data Extraction and Processing in R",
"details": "Extract and process bird sightings records from eBird \n (<http://ebird.org>), an online tool for recording bird observations. \n Public access to the full eBird database is via the eBird Basic Dataset \n (EBD; see <http://ebird.org/ebird/data/download> for access), a downloadable \n text file. This package is an interface to AWK for extracting data from the \n EBD based on taxonomic, spatial, or temporal filters, to produce a \n manageable file size that can be imported into R.",
"maintainer": "Matthew Strimas-Mackey",
"keywords": "dataset, ebird",
"github": "https://github.com/CornellLabofOrnithology/auk",
"status": {
@maelle
maelle / ro_topics.R
Created June 12, 2019 11:30
Add r, rstats and r-package topics to rOpenSci packages
repos <- ghrecipes::get_repos("ropensci")
repos <- dplyr::mutate(repos,
name = stringr::str_remove(name,
"ropensci\\/"))
# archived
repos <- dplyr::filter(repos, !is_archived)
# are packages
repos$is_pkg <- purrr::map_lgl(repos$name,
@maelle
maelle / ro_docs.R
Created June 12, 2019 12:00
Add docs URL
docs <- gh::gh('/users/ropensci-docs/repos?per_page=100', .limit = 1000)
repos <- ghrecipes::get_repos("ropensci")
repos2 <- ghrecipes::get_repos("ropenscilabs")
repos <- dplyr::bind_rows(repos[, "name"], repos2[, "name"])
docs <- tibble::tibble(name = purrr::map_chr(docs, "name"))
repos <- tidyr::separate(repos, name, "/", into = c("org", "name"))
docs <- dplyr::left_join(docs, repos, by = "name")
docs <- docs[!is.na(docs$org),]

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@maelle
maelle / punctuation.R
Created October 12, 2021 13:48
Extract special and operators from R code
path <- #path to pkg
scripts <- fs::dir_ls(file.path(path, "R"))
parse_one <- function(filename) {
filename |>
brio::read_lines() |>
purrr::discard(function(x) grepl("^#'", x)) |>
glue::glue_collapse(sep = "\n") |>
downlit::highlight(classes = downlit::classes_pandoc(), code = TRUE, pre = "bla") |>
xml2::read_html() |>