Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
# Author: Joona Lehtomäki <[email protected]> | |
# Updated: 13.11.2011 | |
# Version: 0.0.1 | |
if (!require("rgdal")) { | |
install.packages("rgdal") | |
} | |
if (!require("raster")) { | |
install.packages("raster") |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
/* | |
* NAME | |
* | |
* statistics-distributions.js - JavaScript library for calculating | |
* critical values and upper probabilities of common statistical | |
* distributions | |
* | |
* SYNOPSIS | |
* | |
* |
import numpy as np | |
# Author : Alexandre Gramfort | |
# license : BSD | |
def pav(y): | |
""" | |
PAV uses the pair adjacent violators method to produce a monotonic | |
smoothing of y |
doInstall <- TRUE | |
toInstall <- c("sna", "igraph") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
adjacencyList <- read.csv("https://dl.dropbox.com/s/8wabcrtqxysp03u/Twitter_network.R.csv?dl=1") | |
head(adjacencyList) | |
adjacencyMatrix <- table(adjacencyList) | |
as.matrix(sort(rowSums(adjacencyMatrix))) # Out-degree |
plot.nnet<-function(mod.in,nid=T,all.out=T,all.in=T,wts.only=F,rel.rsc=5,circle.cex=5,node.labs=T, | |
line.stag=NULL,cex.val=1,alpha.val=1,circle.col='lightgrey',pos.col='black',neg.col='grey',...){ | |
require(scales) | |
#gets weights for neural network, output is list | |
#if rescaled argument is true, weights are returned but rescaled based on abs value | |
nnet.vals<-function(mod.in,nid,rel.rsc){ | |
library(scales) |
## Add an alpha value to a colour | |
add.alpha <- function(col, alpha=1){ | |
if(missing(col)) | |
stop("Please provide a vector of colours.") | |
apply(sapply(col, col2rgb)/255, 2, | |
function(x) | |
rgb(x[1], x[2], x[3], alpha=alpha)) | |
} |
# Include the following in a chunk up the top of your document | |
# Then in your plot chunk, use 'fig.cap=cap()'. | |
# Set the title of your ggplot via `labs(title="mytitle")`, and | |
# it will automatically be substituted into the chunk options | |
# as 'fig.cap' | |
library(knitr) | |
opts_knit$set(eval.after='fig.cap') | |
cap <- function () { | |
p <- last_plot() | |
if (!is.null(p) && !is.null(p$labels$title)) { |
library(httr) | |
library(digest) | |
library(XML) | |
s3_request <- function(verb, bucket, path = "/", query = NULL, | |
content = NULL, date = NULL) { | |
list( | |
verb = verb, | |
bucket = bucket, | |
path = path, |