-
iTerm2
-
Command Line Tools
xcode-select –install
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) | |
# This fake data matches real-world data I was given. | |
# The level of analysis is the units of peppers (rows), | |
# but we see subunits here, and need to make those the | |
# level of analysis - one subunit per row, i.e., tidy. | |
# Notice the description column is not named like the | |
# other subunit columns. | |
# This data matches the example described on the pivot_longer | |
# help page as "Multiple observations per row." |
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(data.table) # for fwrite() | |
library(stringr) | |
library(purrr) | |
# file names we will use when writing 20,000 CSV files to disk | |
filenames <- paste0("files/", "a_", | |
str_pad(1:20000, width = 5,side = "left", pad = "0"), | |
".csv") | |
# some vectors we can sample from to make a table |
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(here) | |
library(rtweet) | |
library(tidyverse) | |
library(assertthat) | |
#---- prep ---- | |
my_dir <- here() |
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
order_months <- function(x = NULL, label = "abb") { | |
# This function takes a given month number or the current month | |
# number and returns a character vector of the last 12 months, | |
# including current month. For example, if it is now February: | |
# "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec" "Jan" "Feb" | |
# is returned with the current month at the end. | |
# This makes a nice x axis if you need to plot something for | |
# the "last 12 months". | |
# if x is NULL the current month is taken from Sys.Date |
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(data.table) | |
library(dplyr) | |
library(purrr) | |
# lots of dates | |
date = seq.Date(from = as.Date("1900-01-01"), | |
to = as.Date("2900-12-31"), | |
by = "day") | |
# lots of cases |