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
library(sjPlot)
library(sjmisc)
library(lme4)
# load sample data set.
data(efc)
efc$scale_c12hour <- scale(efc$c12hour)
efc$scale_e15reat <- scale(efc$e15relat)
m <- glmer(c175empl ~ scale_c12hour + scale_e15reat + (1|resttotn), data=efc, family=binomial(link = "logit"))
dat <- data.frame(A=c(1,2,3,4,5,6), B=c("Dog","Cat","Bird"))
dat2 <- dat[dat$B!="Bird",]
uni <- unique(dat2$B)
dat2$B <- factor(dat2$B, levels=uni)
dfa <- data.frame(a=1, b=2, c=3)
dfb <- data.frame(a=1, b=2, c=3)
dfc <- data.frame(a=1, b=2, c=3)
dflist <- list()
dflist[["dfa"]] <- dfa
dflist[["dfb"]] <- dfb
dflist[["dfc"]] <- dfc
library(ggplot2)
library(tidyverse)
faithful$group <- factor(ifelse(faithful$eruptions>3, 1, 0))
subfaith <- faithful %>% filter(group=="1")
ggplot(data=faithful,aes(waiting, eruptions, color = group)) +
geom_point() +
stat_ellipse(data=subfaith,aes(waiting, eruptions, color = group))
library(maptools)
## --- from http://www.naturalearthdata.com/downloads/10m-physical-vectors/
srange <- readShapePoly("gis/ne_10m_lakes")
## --- Only the largest lakes
srange <- srange[srange$scalerank==0,]
library(tidyverse)
data(iris)
sub_iris <- iris %>%
filter(Species != "setosa")
model <- t.test(Sepal.Length ~ Species, data=sub_iris)

Please cite all software and versions of those software which you use in your methods section, this includes R packages. If you are using R, you can find the citation for your R version with >citation() and for a particular package by using the >citation(“packagename”) function.

Roughly 8% of men, and 1 in 200 women are red-green color blind, so likely will be some of the readers of your paper. Please select a color-blind friendly color scheme for any figures where you use color. http://colorbrewer2.org/ is a great resource for this. If you are using R to make your figures, the RColorBrewer package can be used to easily bring those color schemes into R and apply them to your figures.

library(purrr)
library(repurrrsive)
data(sw_films)
data(sw_people)
# here is the list
swfilms <- map(sw_films, "characters") %>%
set_names(map_chr(sw_films, "title"))
#
character_df <- map_df(sw_people, `[`,
library(ggplot2)
dat <- data.frame(bars = rep(c("a","b","c","d"), each=3),
stacks = rep(c("a","b","c"), times=4),
value = c(20,60,20,10,70,20,70,10,20,40,40,20))
dat$stacks <- as.character(dat$stacks)
ggplot(data=dat, aes(x=bars, y=value, fill=stacks))+
geom_bar(stat="identity")
world_map <- rworldmap::getMap()
world_map@data$id = rownames(world_map@data)
world_map.points <- ggplot2::fortify(world_map, region="id")
# Error: IllegalArgumentException: Points of LinearRing do not form a closed linestring