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
mc.int.ex<-function(x.range=c(-3,3),int=c(-1.96,1.96),n=10000,plot=T, | |
plot.pts=T,plot.poly=T,cols=list('black','green','blue'),round.val=2,val=F){ | |
require(scales) | |
#create data for model fit | |
x.fit<-seq(x.range[1],x.range[2],length=n) | |
y.fit<-dnorm(x.fit) | |
dat.fit<-data.frame(x.fit,y.fit) | |
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
if (!require(ggplot2) | !require(scales) | !require(gridExtra) | !require(shiny)) { | |
stop("This app requires the shiny, ggplot2, scales, and gridExtra packages. To install, run 'install.packages(\"name\")'.\n") | |
} | |
# Define server logic required to generate and plot a random distribution | |
shinyServer(function(input, output) { | |
output$intPlot <- renderPlot({ | |
require(ggplot2) | |
require(scales) |
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
column.int<-function(int.fun='dnorm(x)',num.poly=20,from.x=-1.96,to.x=1.96,plot.cum=F){ | |
if (!require(ggplot2) | !require(scales) | !require(gridExtra)) { | |
stop("This app requires the ggplot2, scales, and gridExtra packages. To install, run 'install.packages(\"name\")'.\n") | |
} | |
if(from.x>to.x) stop('Starting x must be less than ending x') | |
if(is.character(int.fun)) int.fun<-eval(parse(text=paste('function(x)',int.fun))) | |
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
SiteName Year Restoration Reference ObserverNames Precipitation Temperature | |
IGH 2005 3 3 Tyler_Amanda 0 48 | |
Kelly 2005 4 2 Patrick_Chelsea 0 48 | |
Carlton 2005 2 3 David_Megan 0 48 | |
IGH 2006 9 6 Tyler_Amanda 0 52 | |
Kelly 2006 9 1 David_Megan 0 52 | |
Carlton 2006 7 3 Patrick_Chelsea 0 52 | |
IGH 2007 12 7 David_Megan 12 41 | |
Kelly 2007 2 18 Jeremy_Lucy 12 41 | |
Carlton 2007 11 2 Patrick_Chelsea 12 41 |
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
\documentclass[a4paper,12pt]{article} %document class declaration (article, report, book, etc) has to go first | |
\usepackage{times} %package imports times new roman font | |
\usepackage[margin=1in]{geometry} %change margins to 1in | |
\begin{document} | |
\renewcommand{\rmdefault}{ptm} | |
\setlength{\parindent}{0mm} %set indentation at start of new paragraphs | |
\setlength{\parskip}{0mm} %set white space between paragraphs |
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
shinyServer(function(input, output) { | |
myData <- reactive({ | |
read.table( | |
input$file$datapath, | |
sep='\t', | |
header=T, | |
stringsAsFactors=F | |
) | |
}) |
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
gar.fun<-function(out.var,mod.in,bar.plot=T,struct=NULL,x.lab=NULL, | |
y.lab=NULL, wts.only = F){ | |
require(ggplot2) | |
require(plyr) | |
# function works with neural networks from neuralnet, nnet, and RSNNS package | |
# manual input vector of weights also okay | |
#sanity checks |
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
plot.area<-function(x,col=NULL,horiz=F,prop=T,stp.ln=T,grp.ln=T,axs.cex=1,axs.lab=T,lab.cex=1, | |
names=c('Group','Step','Value'),...){ | |
#sort out color fector | |
if(!is.null(col)){ | |
if(sum(col %in% colors()) != length(col)) stop('col vector must be in "colors()"') | |
col<-colorRampPalette(col)(ncol(x)) | |
} | |
else col<-colorRampPalette(c('lightblue','green'))(ncol(x)) | |
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
#credit http://stackoverflow.com/questions/13649473/add-a-common-legend-for-combined-ggplots | |
require(ggplot2) | |
require(reshape) | |
require(gridExtra) | |
p.dat<-data.frame(step=row.names(grp.dat),grp.dat,stringsAsFactors=F) | |
p.dat<-melt(p.dat,id='step') | |
p.dat$step<-as.numeric(p.dat$step) |
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
lek.fun<-function(mod.in,var.sens=NULL,resp.name=NULL,exp.in=NULL,steps=100,split.vals=seq(0,1,by=0.2),val.out=F){ | |
require(ggplot2) | |
require(reshape) | |
## | |
#sort out exp and resp names based on object type of call to mod.in | |
#get matrix for exp vars | |
#for nnet |