Skip to content

Instantly share code, notes, and snippets.

@batpigandme
batpigandme / emoji_replace.R
Created August 16, 2017 13:01
From R 📦 [`emo`](https://github.com/hadley/emo) in case this fun disappears...
#' @importFrom stringr str_sub<- str_replace_all str_extract_all str_locate_all
#' @importFrom purrr map_chr map2_chr
ji_glue_one <- function(txt){
rx <- ":[^:]*:[*]?"
pos <- str_locate_all(txt, rx)[[1]]
chunks <- str_extract_all(txt, rx)[[1]]
list <- str_detect( chunks, "[*]$")
chunks <- str_replace_all( chunks, ":[*]?", "")
## So you (don't) think you can review a package
As with so many things in life, I went into the package-reviewing process worried that I'd somehow ruin it— not just the package itself, but the actual onboarding infrastructure...maybe even rOpenSci on the whole.
Barring the destruction of someone else's hard work and/or an entire organization, I was fairly confident that I'd have little to offer in the way of useful advice. _What if I have absolutely nothing to say other than, yes, this is, in fact, a package?!_
![rOpenSci package review: what I imagined](https://i.imgur.com/np59m8Z.png)
So, step one (for me) was: confess my inadequacies and seek advice. It turns out that much of the advice vis-à-vis _how to review a package_ is baked right into the documents. The [reviewer template](https://github.com/ropensci/onboarding/blob/master/reviewer_template.md) is a great trail map, the utility of which is fleshed out in the [rOpenSci Package Reviewing Guide](https://github.com/ropensci/onboarding/blob/master/r
@batpigandme
batpigandme / random_forests_in_r.Rmd
Last active August 1, 2017 13:32
Code from Random Forests in R by Anish Singh Walia on DataScience+ https://datascienceplus.com/random-forests-in-r/
---
title: "Random Forests in R"
output: html_notebook
---
From [**Random Forests in R**](https://datascienceplus.com/random-forests-in-r/) by [Anish Singh Walia](https://datascienceplus.com/author/anish-singh-walia/) (@[anish_walia](https://twitter.com/anish_walia)), via [**DataScience+**](https://datascienceplus.com).
# Implementation in R
```{r message=FALSE}
library(emo)
library(stringr)
library(purrr)
emoji_name <- emo:::emoji_name
emoji_keyword <- emo:::emoji_keyword
maybe_emoji <- function( keyword ){
if (keyword %in% names(emoji_name)) {
@batpigandme
batpigandme / rmd_highlight.css
Last active May 17, 2017 11:43
R Markdown highlight css modified to tomorrow night bright colors
pre .operator,
pre .paren {
color: #eaeaea
}
pre .literal {
color: #990073
}
pre .number {
@batpigandme
batpigandme / pam_bigrams.csv
Last active May 6, 2017 13:43
Bigrams for Pam, Seasons 1 -7, stop words removed, and tokens unnested using tidytext.
bigram freq speaker
holy shitsnacks 15 PAM
ungh ungh 14 PAM
ms archer 8 PAM
yum yum 8 PAM
holy shit 7 PAM
ha ha 6 PAM
whoa whoa 6 PAM
aw crap 5 PAM
bawk bawk 5 PAM
@batpigandme
batpigandme / data.json
Last active April 8, 2017 18:52
non-stop-word term freq
[
{"term": "yeah ", "value": 1373},
{"term": "archer ", "value": 926},
{"term": "god ", "value": 867},
{"term": "lana ", "value": 810},
{"term": "wait ", "value": 788},
{"term": "uh ", "value": 778},
{"term": "gonna ", "value": 664},
{"term": "cyril ", "value": 563},
{"term": "hey ", "value": 536},
@batpigandme
batpigandme / nbastatR_error.txt
Created March 28, 2017 18:19
Getting this when I run: devtools::install_github("abresler/nbastatR")
* installing *source* package ‘nbastatR’ ...
** R
** tests
** preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘curlconverter’
ERROR: lazy loading failed for package ‘nbastatR’
* removing ‘/Users/maraaverick/Library/R/3.3/library/nbastatR’
Error: Command failed (1)
@batpigandme
batpigandme / string_elt_error.txt
Created March 12, 2017 13:15
NULL character vector error in classic_you 2017-03-12
Error in mutate_impl(.data, dots) : STRING_ELT() can only be applied to a 'character vector', not a 'NULL'
26.
mutate_impl(.data, dots)
25.
mutate.tbl_df(., instance = row_number(term))
24.
mutate(., instance = row_number(term))
23.
function_list[[1L]](value)
22.

Keybase proof

I hereby claim:

  • I am batpigandme on github.
  • I am maraaverick (https://keybase.io/maraaverick) on keybase.
  • I have a public key ASBGZYlMVMOAmXm5NnWjniIDny002jlVi144EAtWkvcz9wo

To claim this, I am signing this object: