This file contains hidden or 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
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 |
This file contains hidden or 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
> 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 |
This file contains hidden or 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
(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")) |
This file contains hidden or 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
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 |
This file contains hidden or 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
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)) |
This file contains hidden or 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
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)) | |
### | |
This file contains hidden or 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
do({spre <<- .; .}) %>% |
This file contains hidden or 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
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")) |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
# 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) |