Skip to content

Instantly share code, notes, and snippets.

View timtrice's full-sized avatar

Tim Trice timtrice

View GitHub Profile
{
"source_with_echo": true,
"save_workspace": "never",
"load_workspace": false,
"initial_working_directory": "~",
"always_save_history": false,
"num_spaces_for_tab": 4,
"continue_comments_on_newline": true,
"highlight_r_function_calls": true,
"auto_append_newline": true,
[[969235200000,1485.25,1489.75,1462.25,1467.5,1467.5,104794],[969321600000,1467.0,1482.75,1466.75,1478.5,1478.5,103371],[969408000000,1478.75,1480.5,1450.25,1469.5,1469.5,109667],[969494400000,1470.25,1474.0,1455.5,1469.5,1469.5,98528],[969580800000,1454.75,1471.0,1436.75,1468.5,1468.5,97416],[969840000000,1469.5,1477.75,1455.5,1461.0,1461.0,85491],[969926400000,1461.0,1467.0,1442.5,1443.0,1443.0,99803],[970012800000,1444.0,1456.0,1438.25,1446.75,1446.75,101996],[970099200000,1447.75,1481.0,1445.0,1476.0,1476.0,84280],[970185600000,1473.0,1473.25,1454.0,1454.0,1454.0,78277],[970444800000,1453.75,1464.25,1447.5,1456.25,1456.25,84100],[970531200000,1457.25,1474.0,1438.75,1441.5,1441.5,89440],[970617600000,1442.0,1457.25,1432.5,1450.25,1450.25,101607],[970704000000,1449.5,1462.0,1447.25,1456.0,1456.0,92232],[970790400000,1456.0,1460.5,1411.5,1426.25,1426.25,95257],[971049600000,1425.25,1426.75,1408.0,1416.5,1416.5,67432],[971136000000,1417.5,1424.5,1390.0,1391.0,1391.0,106613],[971222400000,1393.5,1398.0,1361.75
# ---- libraries ----
library(multidplyr)
library(parallel)
library(tidyquant)
# ---- settings ----
from <- today() - years(5)
to <- today()
# ---- indices ----
@timtrice
timtrice / rstudio-server-global-options
Last active December 27, 2022 22:12
RStudio Server Global Options
alwaysSaveHistory="0"
cleanTexi2DviOutput="1"
cleanupAfterRCmdCheck="1"
contextIdentifier="823EB729"
cranMirrorChanged="1"
cranMirrorCountry=""
cranMirrorHost="RStudio"
cranMirrorName="Global (CDN)"
cranMirrorRepos=""
cranMirrorUrl="https://cran.rstudio.com/"
@timtrice
timtrice / urllib_request.py
Created December 21, 2018 17:00
Retrieve data products from NHC FTP server
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 21 09:37:09 2018
@author: Tim.Trice
#https://docs.python.org/3/library/urllib.request.html#module-urllib.request
"""
import ftplib
@timtrice
timtrice / beryl-marco.r
Created July 6, 2018 14:17
Comparison of Hurricane Beryl (#4) to Tropical Storm Marco
# Code is not very clean since HURDAT and rrricanes have minor variations in
# naming conventions. Additionally, I lose `Name` in the tidy_wr func when I'd
# prefer to keep it.
library(HURDAT)
library(rrricanes)
library(tidyverse)
beryl <-
get_storms() %>%
@timtrice
timtrice / knit-spin-sql.R
Created February 27, 2018 21:39
Knitr spin some SQL within an R script to markdown
#+ libraries
library(DBI)
db <- dbConnect(RSQLite::SQLite(), dbname = ":memory:")
#+ -- ---- drop_table, engine = "sql", connection = db ----
DROP TABLE IF EXISTS packages
#+ -- ---- create-table, engine = "sql", connection = db ----
CREATE TABLE packages (id INTEGER, name TEXT)
@timtrice
timtrice / rstudio-desktop-user-settings
Last active July 1, 2019 12:28
RStudio Desktop Global Options
alwaysSaveHistory="1"
cleanTexi2DviOutput="1"
cleanupAfterRCmdCheck="1"
contextIdentifier="823EB729"
cranMirrorChanged="1"
cranMirrorCountry=""
cranMirrorHost="RStudio"
cranMirrorName="Global (CDN)"
cranMirrorRepos=""
cranMirrorUrl="https://cran.rstudio.com/"
@timtrice
timtrice / hurricane_loop_examples
Created August 25, 2017 17:26
Examples of storms that have looped and one that came close but did not.
library(ggplot2)
library(HURDAT)
# Loop examples:
# Hurricane Gordon
ggplot(data = filter(AL, Key == "AL121994"), aes(x = Lon, y = Lat)) +
geom_point() +
geom_path()
# Hurricane Roxanne
@timtrice
timtrice / wind_pressure_relationship.R
Created August 25, 2017 12:30
Wind/Pressure linear model
library(dplyr)
library(ggplot2)
library(HURDAT)
# Plot relationship with line marking recorded 951mb pressure from recon
AL %>%
select(Wind, Pressure) %>%
filter(!is.na(Wind), !is.na(Pressure)) %>%
ggplot(aes(x = Wind, y = Pressure)) +
geom_point() +