patRDA: This function transforms the individual color pattern rasters...

View source: R/patRDA.R

patRDAR Documentation

This function transforms the individual color pattern rasters as obtained by the main patternize functions to a dataframe of 0 and 1 values that can be used for constrained Redundancy Analysis (RDA) (rda). This function also allows to plot the analysis including a visualization of the shape changes along the axis.

Description

This function transforms the individual color pattern rasters as obtained by the main patternize functions to a dataframe of 0 and 1 values that can be used for constrained Redundancy Analysis (RDA) (rda). This function also allows to plot the analysis including a visualization of the shape changes along the axis.

Usage

patRDA(
  rList,
  popList,
  colList,
  symbolList = NULL,
  rListPredict = NULL,
  popListPredict = NULL,
  colListPredict = NULL,
  symbolListPredict = NULL,
  plot = FALSE,
  plotType = "points",
  plotChanges = FALSE,
  PCx = 1,
  PCy = 2,
  plotCartoon = FALSE,
  refShape = NULL,
  outline = NULL,
  lines = NULL,
  landList = NULL,
  adjustCoords = FALSE,
  crop = c(0, 0, 0, 0),
  flipRaster = NULL,
  flipOutline = NULL,
  imageList = NULL,
  cartoonID = NULL,
  colpalette = NULL,
  normalized = NULL,
  cartoonOrder = "above",
  lineOrder = "above",
  cartoonCol = "gray",
  cartoonFill = NULL,
  plotLandmarks = FALSE,
  landCol = "black",
  zlim = c(-1, 1),
  legendTitle = "Predicted",
  xlab = "",
  ylab = "",
  main = ""
)

Arguments

rList

List of raster objects.

popList

List of vectors including sampleIDs for each population.

colList

List of colors for each population.

symbolList

List with graphical plotting symbols (default = NULL).

rListPredict

List of raster objects to predict into DFA space (default = NULL).

popListPredict

List of vectors including sampleIDs for each set of predict samples (default = NULL). Note to that this also has to be a list if only one population is included.

colListPredict

List of colors for each set of predict samples (default = NULL).

symbolListPredict

List with graphical plotting symbols for predict sets (default = NULL).

plot

Whether to plot the PCA analysis (default = FALSE).

plotType

Plot 'points' or sample 'labels' (default = 'points')

plotChanges

Wether to include plots of the changes along the PC axis (default = FALSE).

PCx

PC axis to be presented for x-axis (default PC1).

PCy

PC axis to be presented for y-axis (default PC2).

plotCartoon

Whether to plot a cartoon. This cartoon should be drawn on one of the samples used in the analysis.

refShape

This can be 'target' in case the reference shape is a single sample (for registration analysis) or 'mean' if the images were transformed to a mean shape (only for meanshape when using landmark transformation)

outline

xy coordinates that define outline.

lines

list of files with xy coordinates of line objects to be added to cartoon.

landList

Landmark landmarkList.

adjustCoords

Adjust landmark coordinates.

crop

Vector c(xmin, xmax, ymin, ymax) that specifies the pixel coordinates to crop the original image used in landmark or registration analysis.

flipRaster

Whether to flip raster along xy axis (in case there is an inconsistency between raster and outline coordinates).

flipOutline

Whether to flip plot along x, y or xy axis.

imageList

List of image should be given if one wants to flip the outline or adjust landmark coordinates.

cartoonID

ID of the sample for which the cartoon was drawn.

colpalette

Vector of colors for color palette (default = c("white","lightblue","blue","green", "yellow","red"))

normalized

Set this to true in case the summed rasters are already devided by the sample number.

cartoonOrder

Whether to plot the cartoon outline 'above' or 'under' the pattern raster (default = 'above'). Set to 'under' for filled outlines.

lineOrder

Whether to plot the cartoon lines 'above' or 'under' the pattern raster (default = 'above').

cartoonCol

Outline and line color for cartoon (deafault = 'gray').

cartoonFill

Fill color for outline of cartoon (default = NULL).

plotLandmarks

Whether to plot the landmarks from the target image or mean shape landmarks (default = FALSE).

landCol

Color for plotting landmarks (default = 'black').

zlim

z-axis limit (default = c(0,1))

legendTitle

Title of the raster legend (default = 'Proportion')

xlab

Optional x-axis label.

ylab

Optional y-axis label.

main

Optional main title.

Value

If plot = TRUE: List including a [1] dataframe of the binary raster values that can be used for discriminant function analysis, [2] a dataframe of sample IDs and specified population colors and [3] lda results. if rListPredict not empty: [4] class prediction of samples. If plot = FALSE: lda result only.

See Also

lda

Examples

data(rasterList_lanRGB)

pop1 <- c('BC0077','BC0071')
pop2 <- c('BC0050','BC0049','BC0004')
popList <- list(pop1, pop2)
colList <- c("red", "blue")

pcaOut <- patRDA(rasterList_lanRGB, popList, colList, plot = TRUE)


patternize documentation built on Aug. 22, 2023, 5:07 p.m.