Skip to content

Instantly share code, notes, and snippets.

View romainfrancois's full-sized avatar
🎉
tada⬢science ⬡⬡ ex(Posit/RStudio, ThinkR, Mango Solutions)

Romain François romainfrancois

🎉
tada⬢science ⬡⬡ ex(Posit/RStudio, ThinkR, Mango Solutions)
View GitHub Profile
romainfrancois@sherlox /tmp % brew install apache-arrow --HEAD -v
==> Downloading https://github.com/apache/arrow/commit/ae60bad1c2e28bd67cdaeaa05f35096ae193e43a.patch?full_index=1
Already downloaded: /Users/romainfrancois/Library/Caches/Homebrew/downloads/bebaf2a7625dae0afc3e8aca8f0a05cd8f341811c2661341315d537706ac2cfc--ae60bad1c2e28bd67cdaeaa05f35096ae193e43a.patch
==> Verifying bebaf2a7625dae0afc3e8aca8f0a05cd8f341811c2661341315d537706ac2cfc--ae60bad1c2e28bd67cdaeaa05f35096ae193e43a.patch checksum
==> Cloning https://github.com/apache/arrow.git
Updating /Users/romainfrancois/Library/Caches/Homebrew/apache-arrow--git
git config remote.origin.url https://github.com/apache/arrow.git
git config remote.origin.fetch \+refs/heads/master:refs/remotes/origin/master
git config remote.origin.tagOpt --no-tags
git fetch origin
@romainfrancois
romainfrancois / dplyr_erum.R
Created June 29, 2020 07:17
code used in my dplyr talk at e-Rum 2020
library(dplyr, warn.conflicts = FALSE)
library(palmerpenguins)
# multiple rows
penguins %>%
group_by(species) %>%
summarise(
prob = c(.25, .75),
length = quantile(bill_length_mm, prob, na.rm = TRUE),
depth = quantile(bill_depth_mm, prob, na.rm = TRUE)
library(dplyr)
library(purrr)
df <- tribble(
~x, ~y,
"a", "b",
"c", "b",
"b", "a",
"b", "b",
"a", "a"
suppressMessages(library(tidyverse))
musique <- jsonlite::read_json("https://www.data.gouv.fr/fr/datasets/r/0dba0390-5eba-401f-aae5-933243c0b163", simplifyDataFrame = TRUE)$fields
musique %>%
pull("keywords_fr") %>%
str_split(";") %>%
flatten_chr() %>%
table() %>%
enframe() %>%
library(tidyverse)
library(rtweet)
library(glue)
library(rtweet)
# likes <- <chr vector of accounts that liked the tweet>
# retweets <- <chr vector of accounts that retweeted the tweet>
data <- tibble(
user = c(likes, retweets),
if(interactive()) {
.__Rprofile_env__. <- new.env(parent = emptyenv())
.__Rprofile_env__.[["install"]] <- pak::pkg_install
attach(.__Rprofile_env__.)
library(usethis, warn.conflicts = FALSE)
library(conflicted)
conflict_prefer("filter", "dplyr")
conflict_prefer("sql", "dbplyr")
library(purrr)
library(rap)
library(gapminder)
library(dplyr, warn.conflicts = FALSE)
oceania <- gapminder::gapminder %>%
filter(continent == "Oceania") %>%
mutate(yr1952 = year - 1952) %>%
select(-continent) %>%
library(dplyr, warn.conflicts = FALSE)
library(purrr)
named_group_split <- function(...) {
data <- group_by(...)
names <- group_keys(data) %>%
map(as.character) %>%
reduce(paste, sep = "~~")
library(dplyr, warn.conflicts = FALSE)
library(purrr)
expressions <- function(vars, funs) {
#' make_expr("mpg", mean)
make_expr <- function(var, fun) {
expr((!!fun)(!!sym(var)))
}