http://www.ers.usda.gov/data-products
http://download.bls.gov/pub/time.series/ap/
A <- matrix(NA, nrow = 4, ncol = 7) | |
x <- function(A){ | |
total_pairs <- nrow(A) * ncol(A) | |
rc <- matrix(NA, ncol = 2, nrow = total_pairs) | |
k <- r <- c <- 1 | |
while (k <= total_pairs) { | |
rc[k, 1] <- r | |
rc[k, 2] <- c | |
k <- k+1 |
## Universities | |
Data and Story Librbary | |
Berkley Data Lab | |
UCLA Statistics Data Sets | |
## General Data | |
freebase.com | |
infochimps.org | |
numbrary.com | |
aggdata.com |
library(dplyr) | |
library(jsonlite) | |
pets <- list() | |
for(i in 1:6){ | |
offset_ <- seq(0, 5000, by = 1000) | |
query_ <- paste0("https://api.whitehouse.gov/v1/petitions.json?limit=1000&offset=", offset_[i]) | |
pets[[i]] <- fromJSON(query_)[[2]] | |
Sys.sleep(0.5) |
# Draw a normal distribution curve on top of a histogram | |
# of any vector | |
# | |
# @param data A numeric vector | |
hist_and_norm <- function(data){ | |
hist_min <- mean(data) - 4*sd(data) | |
hist_max <- mean(data) + 4*sd(data) | |
normalx <- seq(hist_min, hist_max, by = 1) | |
normaly <- dnorm(normalx, mean = mean(data), sd = sd(data)) |
library(splines) | |
set.seed(3-29-2016) | |
X <- rnorm(1000) | |
Y <- rnorm(1000) | |
model <- lm(Y ~ ns(X, 6)) | |
lo <- loess(Y ~ X, span = .75) |
```{r} | |
# Write some R code here! | |
x <- rnorm(10) | |
x^2 | |
plot(x) | |
``` |
library(dplyr) | |
library(forcats) | |
library(ggplot2) | |
iris.small <- datasets::iris %>% | |
dplyr::filter(Species != "setosa") %>% | |
dplyr::mutate(Species = fct_drop(Species)) %>% | |
dplyr::group_by(Species) %>% | |
dplyr::summarize(avg_sl = mean(Sepal.Length), | |
avg_sw = mean(Sepal.Width), |
alias wifi='networksetup -setairportpower en0 off;sleep 2;networksetup -setairportpower en0 on' |
#' @importFrom shiny | |
#' @import miniUI | |
codefinch_app <- function(){ | |
ui <- miniPage( | |
gadgetTitleBar("Codefinch: Tweet Your Code", | |
right = miniTitleBarButton("tweet_it", "Send Tweet", primary = TRUE)), | |
miniContentPanel( | |
fillCol(flex = c(5, 2), | |
imageOutput("code_png"), | |
fillRow(flex = c(2, 1), |