wplot_phase: Function to plot samples' linear discriminant scores and...

View source: R/wplot_phase.R

wplot_phaseR Documentation

Function to plot samples' linear discriminant scores and model's centroids by phase or site

Description

A function which plots the samples' linear discriminant scores from wmodel.LDA compared to the chosen modern model's group centroids as stacked graphs depending on number of grouping variables (i.e. sites or phase).

Usage

wplot_phase(model, x,
site= c("phase 1", "phase 2", "phase 3", "phase 4", "phase 5"),
g1=NULL, g2= NULL, g3=NULL, g4=NULL, g5=NULL,
gcol=c("black","black","black","black", "black"),
gpch=c(22,23,24,8,4), gbg=c("grey","grey","grey","grey", "grey"), pcolumn, compact= FALSE,
priority= "density", xlims= NULL, ylims = NULL, ticks =NULL, xlab="Discriminant function",
lines=TRUE, lcex=1)

Arguments

model

Either "model1", "model2" or "model3" - following wmodel.LDA

x

The output from wmodel.LDA, or one containing LDA scores. This should also contain a grouping variable to be used in argument pcolumn

site

The names to appear in the legend

g1

Name of phase/site group 1 in pcolumn

g2

Name of phase/site group 2 in pcolumn

g3

Name of phase/site group 3 in pcolumn

g4

Name of phase/site group 4 in pcolumn

g5

Name of phase/site group 5 in pcolumn

gcol

Symbol colour for athe entered samples' phases

gpch

Symbol shape for the entered samples' phases

gbg

Symbol infill colour if using pch 21,22,23,24 or 25

pcolumn

The column with the phases of each sample from the dataframe x

compact

Follows swarmy from the beeswarm package

priority

Follows the swarmy function relating to the method of point layout

xlims

The x axis limits

ylims

The y axis limits

ticks

The location of the x axis ticks

xlab

x axis label

lines

Adds lines from group centroid to x-axis

lcex

Size of the legend text

Author(s)

Elizabeth Stroud

See Also

wmodel.LDA, wplot_geog, wplot_basic

Examples

## Example dataset

LD1<-runif(40, min=-6.6, max=6)
Study<-sample(1:3, 40, replace=TRUE)
data<-data.frame(Study,LD1)

## If using defaults

wplot_phase( "model1", data, pcolumn= data$Study, g1=1, g2=2, g3=3,
site=c("phase 1", "phase 2", "phase 3"))

## Changes to colour and symbol type

wplot_phase( "model1", data, pcolumn= data$Study, g1=1, g2=2, g3=3,
site=c("phase 1", "phase 2", "phase 3"),gpch = c(24,4,22), gbg = c("red","black","grey"),
gcol=c("black","black","black"))

elizabethastroud/FIBS-R-Package documentation built on Sept. 26, 2024, 6:40 p.m.