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
slideFunct <- function(data, window, step){ | |
total <- length(data) | |
spots <- seq(from = 1, to = (total - window + 1), by = step) | |
result <- vector(length = length(spots)) | |
for(i in 1:length(spots)){ | |
result[i] <- mean(data[spots[i]:(spots[i] + window - 1)]) | |
} | |
return(result) | |
} |
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
\documentclass{beamer} | |
\usetheme{Singapore} | |
\usepackage{tipa} | |
%% Make the r-code small | |
\ifdefined\knitrout | |
\renewenvironment{knitrout}{\begin{footnotesize}}{\end{footnotesize}} | |
\else | |
\fi |
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
# Replicating / improving http://shaheeilyas.com/flags/ | |
# Drawing a scatter plot of raster images | |
doInstall <- TRUE # Change to FALSE if you don't want packages installed. | |
toInstall <- c("png", "reshape", "ggplot2", "MASS") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
# Go to https://www.gosquared.com/resources/2400-flags, download the ZIP, | |
# and put the 64 x 64 files into a directory of your choosing. |
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(RJSONIO) | |
shinyServer(function(input, output, session) { | |
output$test <- renderUI({ | |
noPoints <- as.integer(input$obs) | |
series <- toJSON(cbind(seq(88, 266, by = (266-88)%/%(noPoints-1)), 113)) | |
tags$script(HTML( | |
paste0("$(document).ready(function () { | |
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
<script src="http://d3js.org/d3.v3.js"></script> | |
<script type="text/javascript"> | |
(function(){ | |
// Probably not idiomatic javascript. | |
this.countValue=0; | |
updateView = function(message) { | |
var svg = d3.select(".d3io").select("svg") |
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
(* EXPORT ALL SKIM NOTES TO EVERNOTE WITH HYPERLINKS | |
-- Stephen Margheim | |
-- 9/7/13 | |
-- open source | |
REQUIRED PROGRAMS: | |
- Skim (pdf viewer and annotator) | |
- Evernote (cloud based note app) |
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
#!/opt/local/bin/perl | |
## | |
## Slightly more idiomatic and optimized Perl of 2num.pl from | |
## http://github.com/brendano/awkspeed/tree/master | |
## | |
use strict; | |
use warnings; | |
open( my $vocab_fh, '>', "vocab" ) or die "vocab: $!\n"; |
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
## in server.r | |
output$null_plot <- renderDygraph({ | |
## don't output anything unless you have the data ready | |
validate( | |
need(casualImpactData(), "Model Working") | |
) | |
## the data for the plot is in here | |
ci <- casualImpactData()$series | |
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("RWeka") | |
library("tm") | |
data("crude") | |
BigramTokenizer <- function(x) NGramTokenizer(x, Weka_control(min = 2, max = 2)) | |
tdm <- TermDocumentMatrix(crude, control = list(tokenize = BigramTokenizer)) | |
inspect(tdm[340:345,1:10]) |
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
### An example of building a TensorFlow model from R using rPython ### | |
# For this script you need to | |
# 1. Have python 2.7 installed. | |
# 2. Install the rPython package in R. | |
# 3. Install Google's TensorFlow library as per these instructions: | |
# http://www.tensorflow.org/get_started/os_setup.md#binary_installation | |
### Here is how to setup and run a trivial TensorFlow model ### | |
# Load TensorFlow (I couldn't get this to work without setting sys.argv... ) |
OlderNewer