library(purrr)
library(rlang)
#>
#> Attaching package: 'rlang'
#> The following objects are masked from 'package:purrr':
#>
#> %@%, %||%, as_function, flatten, flatten_chr, flatten_dbl,
#> flatten_int, flatten_lgl, invoke, list_along, modify, prepend,
#> rep_along, splice
devtools::install_github("tidyverse/dplyr", ref = "feature-341-zero-length-groups")
# [...]
library(dplyr)
# [...]
d <- data_frame(
f = factor(c("a", "b"), levels = c("a", "b", "c")),
x = 1:2
)
This file contains 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
#include <Rcpp.h> | |
using namespace Rcpp; | |
List foo(){ | |
return List::create(1, 2, 3 ) ; | |
} | |
NumericMatrix bar(){ | |
return NumericMatrix(10, 10); | |
} |
This file contains 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
``` r | |
library(purrr) | |
library(dplyr) | |
#> | |
#> Attaching package: 'dplyr' | |
#> The following objects are masked from 'package:stats': | |
#> | |
#> filter, lag | |
#> The following objects are masked from 'package:base': | |
#> |
This file contains 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
``` r | |
library(purrr) | |
library(dplyr) | |
#> | |
#> Attaching package: 'dplyr' | |
#> The following objects are masked from 'package:stats': | |
#> | |
#> filter, lag | |
#> The following objects are masked from 'package:base': | |
#> |
This file contains 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
library(rtweet) | |
library(tidyverse) | |
library(emo) | |
library(lubridate) | |
tweets <- get_timeline("dataandme", include_rts = FALSE, n = 5000) | |
tweets %>% | |
mutate( | |
date = as_date(created_at), |
This file contains 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
library(rtweet) | |
library(tidyverse) | |
tweets <- get_timeline("romain_francois", n = 5000) | |
tweets %>% | |
pull(text) %>% | |
str_extract_all(emo::ji_rx) %>% | |
flatten_chr() %>% | |
table() %>% | |
enframe(name = "emoji") %>% |
This file contains 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
library(tidyverse) | |
library(rtweet) | |
library(glue) | |
get_timeline("LucyStats", n = 100) %>% | |
pull(text) %>% | |
str_extract_all( emo::ji_rx ) %>% | |
flatten_chr() %>% | |
table() %>% | |
enframe() %>% |
This file contains 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
library(purrr) | |
library(assertthat) | |
let <- function(...) quos(...) | |
`:=` <- function(left, right){ | |
names <- map_chr(left, quo_name) | |
assert_that( length(right) >= length(names) ) | |
env <- parent.frame() | |
for( i in seq_along(names) ){ |
This file contains 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
library(tidyverse) | |
library(glue) | |
# i have my reasons, please dont burn my computer | |
setwd("~/git/r-source") | |
extract_isna <- function(.){ | |
cat( "\r", . ) | |
invisible( system(paste0('git checkout -q -f ', .)) ) | |