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(inline) | |
body='NumericVector xx(x); | |
std::vector<double> X(xx.begin(),xx.end()); | |
for (int i = 0;i<X.size();i++) { | |
std::cout << "X[i] = " << X.at(i) << std::endl; | |
} | |
return (xx);' | |
tfun = cxxfunction(signature(x="numeric"),body,plugin="Rcpp") |
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
#!/bin/bash | |
echo "starting qsub script file" | |
source ~/.bash_profile | |
date | |
module load sge/2011.11 | |
# here's the SGE directives | |
# ------------------------------------------ |
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
#include "MyClass.h" | |
// Define Class members | |
// ===================== | |
double MyClass::GetSolution( ) { | |
// point the pt_MyClass element to this class | |
p->pt_MyClass = this; |
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
#include <gsl/gsl_roots.h> | |
#include <gsl/gsl_interp.h> | |
#include <gsl/gsl_spline.h> | |
#include <gsl/gsl_errno.h> | |
#include <iostream> | |
// forward definition of param struct | |
struct gsl_f_pars; |
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
#!/usr/bin/env ruby -w | |
head, treshold = ARGV | |
head ||= 'HEAD' | |
Megabyte = 1000 ** 2 | |
treshold = (treshold || 0.1).to_f * Megabyte | |
big_files = {} | |
IO.popen("git rev-list #{head}", 'r') do |rev_list| | |
rev_list.each_line do |commit| |
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(inline) | |
library(Rcpp) | |
cpp <- 'arma::mat A = Rcpp::as<arma::mat>(X_); | |
arma::vec y(A.n_rows); | |
arma::rowvec tmp(A.n_cols); | |
for (int i=0; i<A.n_rows; i++) { | |
tmp = A.row(i); | |
y(i) = tmp.max(); | |
} |
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(xlsx) | |
cdat <- read.xlsx(file="~/datasets/ReinhardRogoff/18_data.xls",sheetName="Aut.Ita.UK.US") | |
cdat <- cdat[,-c(5,6,7)] | |
library(reshape) | |
library(ggplot2) | |
m <- melt(cdat,c("Year","Country")) | |
p <- ggplot(m,aes(x=Year,y=value)) + geom_line(aes(color=variable),size=1) + facet_wrap(~Country,ncol=1) + scale_y_continuous(name="Public (Public and Private) debt to GDP (GNP) ratios") + theme(legend.position="top") |
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
#LyX 2.0 created this file. For more info see http://www.lyx.org/ | |
\lyxformat 413 | |
\begin_document | |
\begin_header | |
\textclass article | |
\use_default_options true | |
\begin_modules | |
knitr | |
\end_modules | |
\maintain_unincluded_children false |
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
# R script accompanying quasi-concave, concave etc note | |
if(!require(rgl)) install.packages('rgl') | |
require(rgl) | |
# setup data | |
nx <- 50 # points into x direction | |
ny <- 50 # points into y |
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
Creating interactive web graphs with R: Overview and googleVis tutorial | |
======================================== | |
```{r results='asis', echo=FALSE, message=FALSE, tidy=FALSE} | |
library(googleVis) | |
df <- data.frame(Postcode=c("TF3 4JH", "EC1Y 8LX"), | |
Tip=c("Telford", "RSS")) | |
## Tree map | |
T <- gvisTreeMap(Regions, "Region", "Parent", "Val", "Fac", | |
options=list(width=250, height=150, |