This file contains hidden or 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
| def rearrange(input: str, order: str) -> str: | |
| output = [] | |
| for char in order: | |
| [output.append(x) for x in input if x == char] | |
| return ''.join(output) | |
| rearrange("abcab", "bca") | |
| def is_palindrome(input: str) -> bool: | |
| input = input.strip().replace(" ", "").lower() |
This file contains hidden or 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(broom) | |
| library(dplyr) | |
| library(marginaleffects) | |
| # Data grabbed from https://www.andrewheiss.com/blog/2022/05/20/marginalia/data_2022.Rdata | |
| load("data_2022.Rdata") | |
| glimpse(corruption) | |
| ## Simple model |
This file contains hidden or 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(animation) | |
| library(dplyr) | |
| library(ggplot2) | |
| library(lubridate) | |
| library(quantmod) | |
| library(scales) | |
| library(tibble) | |
| library(usmap) | |
| library(viridis) |
This file contains hidden or 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
| altair | |
| asyncssh | |
| awswrangler | |
| boto3 | |
| botocore | |
| dask[complete] | |
| dvc | |
| gensim | |
| linearmodels | |
| matplotlib |
This file contains hidden or 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
| approximate_memory <- function(nrows, ncols) { | |
| round(nrows*ncols*8/2^{20}/1024, 2) | |
| } |
This file contains hidden or 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
| get_recursive <- function(object.name, env = parent.frame()) { | |
| if (identical(emptyenv(), env)) { | |
| stop(paste0("Object '", object.name, "' not found"), call. = FALSE) | |
| } | |
| tryCatch( | |
| get(object.name, env), | |
| error = function(e) recurse_get(object.name, parent.env(env)) | |
| ) | |
| } |
This file contains hidden or 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
| read_data <- function(path, ...) { | |
| file_ext <- unlist(strsplit(path, "\\.")) | |
| file_ext <- file_ext[[length(file_ext)]] | |
| switch( | |
| tolower(file_ext), | |
| parquet = arrow::read_parquet(path, ...), | |
| xlsx = readxl::read_excel(path, ...), | |
| csv = readr::read_csv(path, ...), | |
| fst = fst::read_fst(path, ...), | |
| rds = readRDS(path, ...) |
This file contains hidden or 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
| abind | |
| AER | |
| anytime | |
| arm | |
| arrow | |
| arules | |
| AsioHeaders | |
| askpass | |
| assertthat | |
| backports |
This file contains hidden or 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
| # Example username: ubuntu; Example Public IP: 1.23.456.7 | |
| ssh -i "C:\path\to\PEM.pem" ubuntu@1.23.456.7 |
This file contains hidden or 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
| rmd_skeleton <- function(name = "Untitled", | |
| dir = here::here(), | |
| title = NULL, | |
| author = "Daniel Molitor", | |
| abstract = FALSE) { | |
| path <- paste0(dir, "/", name, ".Rmd") | |
| if (abstract) { | |
| ab <- paste0( | |
| c("abstract: |", | |
| " "), |
NewerOlder