Learn R Programming

AlleleShift (version 1.1-3)

shift.moon.ggplot: Shifts of Allele Frequencies as Response to Climate Change

Description

The function shows changes in allele frequencies between the baseline and future/past climate.

Usage

shift.moon.ggplot(baseline.moon, future.moon,
	manual.colour.values = c("white", "grey", "firebrick3", "chartreuse4"),
	manual.colour.codes = c("A baseline ", "B", "A decreasing", "A increasing"))

moon.waxer(freq.in, sort.index= "Pop.index", mean.change = FALSE, change.FUN = stats::median, freq.focus = "Allele.freq", ypos = 0, right = TRUE)

Value

The function generates a ggplot that depicts changes between baseline and future/past allele frequencies of the populations.

Arguments

baseline.moon, future.moon

Result from AlleleShift::moon.waxer.

manual.colour.values

Colours to be used in the plot.

manual.colour.codes

Sequence for the manual colour values.

freq.in

Result from AlleleShift::predFreq.

sort.index

Sequence of the populations in the plot.

mean.change

Aggregate changes among alleles.

change.FUN

Function used the aggregate changes.

freq.focus

Allele frequency for which to calculate statistics, either 'Allele.freq' or 'Freq.e2'.

ypos, right

Arguments used for plotting, mainly as in geom_moon

Author

Roeland Kindt (World Agroforestry, CIFOR-ICRAF)

See Also

shift.dot.ggplot, shift.pie.ggplot, shift.waffle.ggplot, shift.surf.ggplot

Examples

Run this code

# The data can be obtained via the count.model and freq.model calibrations.
# These procedures are not repeated here.
data(Poptri.freq.baseline)
data(Poptri.freq.future)

Poptri.baseline.moon <- moon.waxer(Poptri.freq.baseline,
                                   sort.index="Latitude.index")

Poptri.future.moon <- moon.waxer(Poptri.freq.future, 
                                 sort.index="Latitude.index",
                                 freq.focus="Freq.e2",
                                ypos=1)

ggmoon1 <- shift.moon.ggplot(Poptri.baseline.moon, 
                             Poptri.future.moon)
ggmoon1

Run the code above in your browser using DataLab