Skip to content

Instantly share code, notes, and snippets.

yonicd

Block or report user

Report or block yonicd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yonicd
yonicd / cvs_rvest.R
Last active Aug 17, 2019
harvesting cvs store locations
View cvs_rvest.R
library(xml2)
library(rvest)
library(glue)
library(dplyr)
library(purrr)
library(purrrogress)
library(ggmap)
library(ggplot2)
srm <- function(x,pat = '\\t+|\\n+',replace = '') gsub(pat,replace,x)
@yonicd
yonicd / anandwrite_twitter_survey_replies.R
Created Apr 12, 2019
code to retrieve @AnandWrites adhoc survey replies
View anandwrite_twitter_survey_replies.R
library(magrittr)
library(rtweet)
root_status <- '1116361675618361345'
x1 <- rtweet::lookup_tweets(root_status)
# The question
cat(x1$text)
#> Who do you:
@yonicd
yonicd / runloc.R
Created Feb 21, 2019
reliably find where script is run from in R
View runloc.R
runloc <- function(path_expand = FALSE){
src <- 'Untitled'
if(rstudioapi::getActiveDocumentContext()$id=='#console')
src <- 'Console'
if(length(getSrcFilename(sys.call(sys.nframe()-1)))>0)
src <- file.path(
getSrcDirectory(sys.call(sys.nframe()-1)),
@yonicd
yonicd / ghnet_ropenscilabs.R
Created Feb 17, 2019
ropenscilabs commit network using ghnet
View ghnet_ropenscilabs.R
remotes::install_github('yonicd/ghnet')
library(ghnet)
# get current github R repos using gepuro json file
universe <- fetch_gepuro()
# filter to ropenscilabs repos only
ropenscilabs_repos <- universe%>%
dplyr::filter(owner=='ropenscilabs')%>%
@yonicd
yonicd / .block
Last active Feb 12, 2019
timevis test
View .block
license: mit
@yonicd
yonicd / app.R
Created Jan 22, 2019
slick rtweet
View app.R
library(rtweet)
library(slickR) # remotes::install_github('metrumresearchgroup/slickR')
tweets <- rtweet::search_tweets("#rstats", n = 5, include_rts = FALSE)
# https://github.com/mkearney/rtweet/pull/305/files
tweet_embed <- function(screen_name,status_id,...){
stem <- 'https://publish.twitter.com/oembed'
@yonicd
yonicd / toddleR.R
Created Jan 20, 2019
toddler in chief analysis
View toddleR.R
library(rvest)
library(patchwork)
tweet_threading <- function(tw){
last_found <- FALSE
while(!last_found){
nr <- nrow(tw)
last_found <- is.na(tw$reply_to_status_id[nr])
@yonicd
yonicd / alm.md
Last active Sep 29, 2018
recurrsive version of `purrr::discard`
View alm.md

Install and load alm

install_github("ropensci/alm")
library("alm")
@yonicd
yonicd / testthat_snippet.R
Last active May 17, 2018
testthat snippets + rsam addin
View testthat_snippet.R
# dummy functions ----
f <- function() {
testthat::expect_is(data.frame(),'data.frame')
}
f1 <- function() {
testthat::expect_is(data.frame(),'list')
}
You can’t perform that action at this time.