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) | |
library(ggmap) | |
# blue bottle coffee shops in SF area | |
latitude <- c(37.782375,37.795933,37.776327,37.762033,37.795966,37.785936) | |
longitude <- c(-122.407567,-122.273128,-122.42328,-122.411603,-122.394025,-122.400761) | |
df2 <- data.frame(longitude=longitude,latitude=latitude) | |
# df to make map title on the water | |
dflabels <- data.frame(longitude=-122.678, |
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
*.pyc |
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
# | |
# PREDICTING LONG TERM CUSTOMER VALUE WITH BTYD PACKAGE | |
# Pareto/NBD (negative binomial distribution) modeling of | |
# repeat-buying behavior in a noncontractual setting | |
# | |
# Matthew Baggott, [email protected] | |
# | |
# Accompanying slides at: | |
# http://www.slideshare.net/mattbagg/baggott-predict-customerinrpart1# | |
# |
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
# | |
# Functions to make ggplot KM survivor curves made with survfit() in library(survival) | |
# | |
# code written by Ramon Saccilotto | |
# and included in his ggplot2 tutorial | |
# 2010-12-08 | |
# define custom function to create a survival data.frame | |
createSurvivalFrame <- function(f.survfit){ | |
# initialise frame variable |
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
## | |
## Example code for time-to-event analysis in R | |
## [email protected] | |
## Dec 28, 2012 | |
## | |
## joineR package: analyzing longitudinal data where the response | |
## from each person is a time-sequence of repeated measurements | |
## and we are interested in a possibly censored time-to-event outcome | |
## | |
## example: repeated ad viewings leading to a sale |
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
## | |
## Sample code to demonstrate circular time plots in R | |
## [email protected] | |
## Dec 22, 2012 | |
# inspired by | |
# http://stackoverflow.com/questions/2076370/most-underused-data-visualization | |
library(lubridate) | |
library(circular) |
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
## | |
## Vignette code for ggsubplot with needed map_afghanistan and map_americas layers | |
## [email protected] | |
## Dec 16, 2012 | |
# install.packages("ggsubplot") | |
library(ggplot2) | |
library(ggsubplot) | |
library(maps) |
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
#Setup | |
rm(list = ls(all = TRUE)) #CLEAR WORKSPACE | |
#Directory | |
setwd("~/Overfitting") | |
#Load Required Packages | |
library('caTools') | |
library('caret') | |
library('glmnet') |
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
## | |
## Sample code to teach about timezones in R | |
## [email protected] | |
## Dec 13, 2012 | |
## Time zones are important to understand when working with dates | |
## because the most common date class for R, POSIX, is actually a date/time | |
## class. (POSIX = "Portable Operating System Interface, | |
## an IEEE standard) | |
## |
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
## | |
## demonstration of distributions overlapping on lineplots | |
## [email protected] | |
## Dec 11, 2012 | |
## | |
## in response to: http://stats.stackexchange.com/questions/45591/r-plot-time-indexed-densities/45614#45614 | |
library(ggplot2) # for plotting | |
library(lubridate) # for getting year from dates in dataset | |
library(plyr) # for getting annual mean easily |
NewerOlder