Species ranges depend on interactions between their traits and the physical environment, and often on species interactions such as competition. Climate change is altering species ranges through its effects these interactions. Jeremy Papuga and Dr. Susan Hoffman are examing those effects in two species of Peromyscus, P. maniculatus gracilis and P. leucopus n.. They have anecdotal evidence that the two species are moving north and that P. leucopus is replacing P. maniculatus in southern sites. Whether they are competing, or whether each is responding to other factors is a different story.
Map of Michigan study sites
Jeremy’s data include numbers of juvenile and adult mice caught in monthly trappings in six sites (see map) over four years. It also includes information about weather, including,
I have created three different data sets that arrange the data in three different ways. Download them to your R work directory and then load them into R to view them.
Import the data sets.
## wide format of weather and population sizes
MayN.wide <- read.csv("MayN_wide.csv")
## peek at the structure of a data set
View(MayN.wide)
## long format of weather and population sizes
MayN.long <- read.csv("MayN_long.csv")
View(MayN.long)
## long format of weather and per capita population growth rates
Mayr.long <- read.csv("Mayr_long.csv")
View(Mayr.long)
Graph your data. Follow these instructions to use
ggplot
### FIRST LOAD THE GGPLOT2 LIBRARY
library(ggplot2)
ggplot() defines the data set, the x-variable, the
y-variable, and any grouping variable.geom_point() creates a scatterplot.geom_smooth( ) adds a fitted line,
either one line or a line for each group if you identified a grouping
variable. You can add a method that specifies what kind of
fit you want.geom_line() connects each point to adjacent points (a
“line graph”).geom_Here is an example of a scatterplot with a simple line connecting observations.
ggplot(data=MayN.wide, aes(x=Year, y=A_PLN, colour=Site)) +
geom_point() +
geom_line() +
labs(x="Calendar year", y="Number of adults")
To save this graph to your working directory, use
ggsave(), for instance,
ggsave("myGraph.png", width=5, height=6) # units are inches
The file extension (png or jpg or pdf) determines the file type.
In sum: Think about causal relationships; represent the predictions in a quantitive graph; graph the actual data; evaluate your hypothesized causal relationship.