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
require(quantmod) | |
require(fAssets) | |
#get asian currency data from the FED FRED data series | |
getSymbols("DEXKOUS",src="FRED") #load Korea | |
getSymbols("DEXMAUS",src="FRED") #load Malaysia | |
getSymbols("DEXSIUS",src="FRED") #load Singapore | |
getSymbols("DEXTAUS",src="FRED") #load Taiwan | |
getSymbols("DEXCHUS",src="FRED") #load China | |
getSymbols("DEXJPUS",src="FRED") #load Japan |
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
### Title: Back to basics: High quality plots using base R graphics | |
### An interactive tutorial for the Davis R Users Group meeting on April 24, 2015 | |
### | |
### Date created: 20150418 | |
### Last updated: 20150423 | |
### | |
### Author: Michael Koontz | |
### Email: mikoontz@gmail.com | |
### Twitter: @michaeljkoontz | |
### |
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
\[[^\]]+\] #everything within square brackets http://regexr.com/3csqg |
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
https://twitter.com/OttawaFieldNat/status/409695678781091840 |
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(emoGG) | |
library(ggplot2) | |
#use subsetting to display different emojis for different factor levels | |
ggplot(mtcars, aes(wt, mpg))+ | |
geom_emoji(data = mtcars[mtcars$am==1, ], emoji = "1f697") + | |
geom_emoji(data = mtcars[mtcars$am==0, ], emoji = "1f68c") |
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
#!/bin/bash | |
# This map is a quick and dirty adaptation of GMT EXAMPLE 25 | |
# (using GMT 5.4.0_r17345) | |
# Purpose: Display distribution of antipode types around NZ | |
# GMT modules: gmtset, grdlandmask, grdmath, grd2xyz, gmtmath, grdimage, pscoast, pslegend | |
# Unix progs: cat | |
# | |
# Create D minutes global grid with -1 over oceans and +1 over land | |
D=10 | |
gmt grdlandmask -Rg -I${D}m -Dc -A500 -N-1/1/1/1/1 -r -Gwetdry.nc |
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
Warning: Function cummax has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. | |
>> edit ths_ds1.dat | |
>> [t,s]=ldf('ths_ds1.dat'); | |
clf | |
plot(t,s,'o') | |
xlabel('Time in seconds') | |
ylabel('Drawdown in meters') | |
title('The Fetter data set') | |
>> diagnostic(t,s) | |
Attempted to access Dk(:,2); index out of bounds because |
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
gc() | |
#devtools::install_github("pboesu/rucrdtw", ref = "expose_distance_calculations") | |
library(rucrdtw) | |
set.seed(12444) | |
x = rnorm(10^4) | |
y = rnorm(10^4) | |
gctorture(on = TRUE) | |
for (i in 1:(2*10^3)) { |
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
--- | |
title: "Academic moves" | |
author: "Philipp Boersch-Supan" | |
date: "2018-02-17" | |
output: | |
html_document: | |
keep_md: yes | |
--- | |
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
require(dplyr) | |
nuts1 <- readr::read_csv('NUTS1_kmsq.csv') | |
nuts1 %>% group_by(ONEKMREF) %>% summarise(biggest_area = max(kmsq_Area), biggest_area_index = which.max(kmsq_Area), biggest_area_name = Region_name[biggest_area_index] ) -> solution_df | |
#check for areas with multiple regions | |
nuts1 %>% group_by(ONEKMREF) %>% summarise(n_rows = n()) %>% arrange(desc(n_rows)) %>% head() |
OlderNewer