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
<!doctype HTML> | |
<meta charset = 'utf-8'> | |
<html> | |
<head> | |
<script src='http://code.jquery.com/jquery-1.9.1.min.js' type='text/javascript'></script> | |
<script src='http://code.highcharts.com/highcharts.js' type='text/javascript'></script> | |
<script src='http://code.highcharts.com/highcharts-more.js' type='text/javascript'></script> | |
<script src='http://code.highcharts.com/modules/exporting.js' type='text/javascript'></script> | |
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(ggplot2) | |
# Sample diamonds dataframe: | |
didat <- diamonds[sample(nrow(diamonds), 1000), ] | |
# Original data: | |
ggplot(didat, aes(x = depth, y = price)) + geom_point() | |
# Transform data: | |
ggplot(didat, aes(x = log10(depth), y = log10(price))) + geom_point() |
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
#' Function to draw observations from stratified norm sample | |
#' | |
#' This function creates a stratified random sample, given an arbitrary number of | |
#' factors and levels within those factors. | |
#' | |
#' @param dat data.frame object | |
#' @param strata character; a named vector indicating the strata variables | |
#' @param observations numeric; number of cases to sample from each strata | |
#' @param return.grid logical; return grid of factor combintions? | |
#' @param full.data logical; return the original dataset with a new logical |