I hereby claim:
- I am mkearney on github.
- I am kearneymw (https://keybase.io/kearneymw) on keybase.
- I have a public key ASAprxnmWoBc1OCGFVW6Lid1F4IXNx6uabYjq-hOiDx_hQo
To claim this, I am signing this object:
library(V8) | |
library(rvest) | |
library(hrbrthemes) | |
library(tidyverse) | |
ctx <- v8() | |
pg <- read_html("https://www.tiobe.com/tiobe-index/") | |
html_nodes(pg, xpath=".//script[contains(., 'series:')]") %>% |
I hereby claim:
To claim this, I am signing this object:
## install {remotes} pkg | |
if (!requireNamespace("remotes", quietly = TRUE)) { | |
install.packages("remotes") | |
} | |
## install {tfse} from github | |
remotes::install_github("mkearney/tfse") | |
## load {tfse} | |
library(tfse) |
## install packages (from CRAN) if not already | |
pkgs <- c("dplyr", "rtweet", "ggplot2", "syuzhet", "ggbeeswarm", "remotes") | |
if (any(!pkgs %in% installed.packages())) { | |
install.packages(pkgs[!pkgs %in% installed.packages()]) | |
} | |
## install {dataviz} theme from github | |
remotes::install_github("mkearney/dataviz") | |
## define paste function I really like rn |
#' Conditionally apply expressions on a data object | |
#' | |
#' @param .data Input data | |
#' @param condition A logical value to determine whether to use .if or .else | |
#' @param .if Formula or function to apply to intput data when condition is TRUE | |
#' @param .else Formula or function to apply to intput data when condition is FALSE | |
#' @return Output of appropriate .if/.else call | |
#' @export | |
#' @importFrom rlang as_closure | |
do_if_else <- function(.data, condition, .if, .else = identity) { |
#!/usr/bin/env Rscript | |
##keynote.R v1.0 Damon Kiesow @dkiesow | |
##Use with the Keynote rTweet AppleScript app to automate threaded tweeting during Keynote presentations | |
## | |
## load rtweet package | |
library(rtweet) | |
me <- rtweet:::home_user() | |
## Pull parameters from command line (first_status will be "yes" or "no" and provided from the AppleScript) | |
args <- commandArgs(trailingOnly = TRUE) |
## generate data set | |
x2 <- rnorm(200) | |
x1 <- x2 + rnorm(200) | |
y2 <- rnorm(200) + x2 | |
y1 <- y2 + rnorm(200) | |
z2 <- rnorm(200) + y2 | |
z1 <- z2 + rnorm(200) | |
d <- data.frame(x1, x2, y1, y2, z1, z2) | |
## specify null and full models |
bytes2char <- function(x) { | |
m <- gregexpr("<[[:alnum:]]{2}>", x) | |
y <- regmatches(x, m)[[1]] | |
y <- gsub("^<|>$", "", y) | |
y <- strsplit(y, "[><]+") | |
regmatches(x, m) <- list(sapply(y, function(.x) rawToChar(as.raw(paste0("0x", .x))))) | |
x | |
} | |
## read in string with bytes |
-- 1. Place in ~/Library/Scripts and enable the Applescript menu via the Applescript Editor | |
-- 2. Substitute "vpn.example.com" and "redacted" for your VPN server and password | |
-- 3. Open Security & Privacy System Preferences, go to Privacy, Accessibility | |
-- 4. Enable Applescript Editor and System UI Server | |
-- 5. Trigger script from the menu | |
-- 6. Enjoy being connected | |
tell application "Cisco AnyConnect Secure Mobility Client" | |
activate | |
end tell |
## load rtweet and congress116 | |
library(rtweet) | |
library(congress116) | |
## create long-version of congress116 data (and drop rows w/o screen names) | |
sns <- with(congress116, data.frame( | |
bioguide = c(bioguide, bioguide[!is.na(screen_name_personal)]), | |
handle = c(screen_name_official, screen_name_personal[!is.na(screen_name_personal)]), | |
stringsAsFactors = FALSE | |
)) |