Skip to content

Instantly share code, notes, and snippets.

View aurielfournier's full-sized avatar
💭
Crunching numbers about birds and how we value them

Auriel M.V. Fournier aurielfournier

💭
Crunching numbers about birds and how we value them
View GitHub Profile
dataframe <- data.frame(silly1 = NA, silly2=NA)
# silly1 silly2
#1 NA NA
sepdf <- data.frame(old=c("a","b"), new=c("d","e")
# old new
#1 a d
> head(amelt)
jdate year variable value
1 227 2013 pred_short 7.737878
2 247 2013 pred_short 38.029255
3 269 2013 pred_short 114.233338
4 237 2013 pred_short 64.805227
5 257 2013 pred_short 154.760291
6 284 2013 pred_short 88.092093
I want to have this
(pp <- ggplot()+
geom_line(data=fit, aes(x=x, y=y, group=year))+
geom_ribbon(data=fit, alpha=0.6, aes(x=x, ymin=lower, ymax=upper, fill=year))+
scale_fill_manual(values=mypal)+
theme_krementz()+
scale_x_continuous(breaks=seq(225,300,5),limits=c(225,300),
labels=c("August 10","August 15","August 20", "August 25","August 30","September 4","September 9","September 14","September 19","September 24","September 29","October 4","October 9","October 14","October 19","October 24"))+
xlab("Date")+
ylab("Sora per Hectare"))
dat <- data.frame(a=c(01,2,3,4,2),b=c(4,3,6,5,4))
ggplot()+geom_point(data=dat, aes(x=a, y=b))+ylab(paste0("\u03B4", ^13, "C", "\u2030"))
# I need this to be the delta symbol a super script 13, a Captal C and the per mil symbol
cool_science_stuff <- data.frame(a=runif(20, 2, 5), b=runif(20, 5, 10), c=rep("long name \nof a thing", 20))
ggplot(data=cool_science_stuff)+
geom_boxplot(aes(x=c, y=a))
cool_science_stuff <- data.frame(a=runif(20, 2, 5), b=runif(20, 5, 10), c=rep("long name \nof a thing", 20))
library(ggplot2)
ggplot(data=cool_science_stuff)+
geom_boxplot(aes(x=c, y=a))
###
do({spre <<- .; .}) %>%
a <- data.frame(firstcolumn = seq(1:10), secondcolumn=rep(c("somestuffhere","someotherstuff"), 5))
a$secondcolumn <- ordered(a$secondcolumn, levels=c("somestuffhere", "someotherstuff"), labels=c("somestuff \nhere", "someother \nstuff"))
# Make Example Graph/Data
a <- data.frame(firstcolumn=seq(1:10), secondcolumn=seq(21:30), thirdcolumn=seq(41:50))
ggplot()+
geom_point(data=a, aes(x=firstcolumn, y=secondcolumn, fill=thirdcolumn))
# One method is to make the column a character instead of a number, than it treats it as discrete
@aurielfournier
aurielfournier / distanim.R
Created February 2, 2017 17:55 — forked from dill/distanim.R
Animation of a simple distance sampling survey.
# animate a (very boring) distance sampling survey
# watch a gif at: http://converged.yt/distance-animation.gif
# written by David Lawrence Miller, with tweaks from Eric Rexstad
# released under the MIT license
library(animation)
# make sure that we get the same result every time...
set.seed(1234)