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(rvest) | |
| library(ggplot2) | |
| library(ggthemes) | |
| library(MASS) | |
| library(splines) | |
| treas.html <- html("http://www.treasury.gov/resource-center/data-chart-center/interest-rates/Pages/TextView.aspx?data=yield") | |
| yield.data <- treas.html %>% | |
| html_nodes("table") %>% | |
| .[[67]] %>% |
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(rvest) | |
| library(ggvis) | |
| wiki.prison <- html("http://en.wikipedia.org/wiki/List_of_countries_by_incarceration_rate") | |
| wiki.prison.data <- wiki.prison %>% | |
| html_nodes("table") %>% | |
| html_nodes("table") %>% | |
| .[[2]] %>% | |
| html_table(fill = TRUE) |
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(foreign) | |
| library(dplyr) | |
| library(ggplot2) | |
| success <- read.dta("ALP_MS118_2016_03_13_06_51_42.dta") | |
| scpc2010 <- read.dta("SCPC2010.dta") | |
| scpc2010.adopt <- scpc2010[ , c("prim_key", "cc_adopt", "cc_sh")] | |
| success.locus <- success[ , c("ms118_prim_key", "ms118_lc1")] |
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
| # http://stackoverflow.com/questions/6491532/how-to-subset-a-file-select-a-numbers-of-rows-or-columns | |
| cat largefile | awk 'NR >= 10000 && NR <= 100000 { print }' |
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
| awk 'NR%20==1 { file = FILENAME "_" sprintf("%04d", NR+19) } { print > file }' domains.xml |
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
| * Two-sample comparison of mean1 to mean2. Compute sample sizes with n2/n1 = 2: | |
| sampsi 132.86 127.44, p(0.8) r(2) sd1(15.34) sd2(18.23) | |
| power twomeans 132.86 127.44, p(0.8) nratio(2) sd1(15.34) sd2(18.23) |
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
| '%==%' <- function(a, b) { | |
| equality.test <- (a == b) | |
| equality.test[is.na(a) & is.na(b)] <- TRUE | |
| equality.test[is.na(equality.test)] <- FALSE | |
| return(equality.test) | |
| } |
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
Show hidden characters
| { | |
| "always_show_minimap_viewport": true, | |
| "bold_folder_labels": true, | |
| "caret_extra_bottom": 1, | |
| "caret_extra_top": 1, | |
| "caret_extra_width": 1, | |
| "caret_style": "blink", | |
| "color_scheme": "Packages/Material Theme/schemes/Material-Theme-Darker.tmTheme", | |
| "fade_fold_buttons": false, | |
| "font_face": "Source Code Pro", |
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
| # http://stats.stackexchange.com/questions/66757/random-forest-vs-regression | |
| beta <- runif(5) | |
| x <- matrix(rnorm(500), nc=5) | |
| y <- drop(x %*% beta) | |
| dat <- data.frame(y=y, x1=x[,1], x2=x[,2], x3=x[,3], x4=x[,4], x5=x[,5]) | |
| model1 <- lm(y~., data=dat) | |
| model2 <- randomForest(y ~., data=dat) | |
| pred1 <- predict(model1 ,dat) | |
| pred2 <- predict(model2 ,dat) |
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
| # Install ffmpeg with the right codec | |
| brew install ffmpeg --with-fdk-aac | |
| # Actual loop | |
| for i in *flac;do of="${i/.flac/.m4a}"; ffmpeg -i "${i}" -c:a libfdk_aac -b:a 320k "${of}";done | |