-
Notifications
You must be signed in to change notification settings - Fork 0
linleyj/traitR
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
--- title: "traitR documentation" author: "Linley" date: "June 28, 2016" output: github_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ##TraitR - an R implementation of TraitSpaces <br> ###Description TraitR is the R version of traitspaces written by Steve Heard (initially in visualbasic). Chandra Moffit and I recoded it for R and I decided to shinyfy it. There are two versions: a standalone and the shiny app. ###usage: <br>source("traitR_standalone_pca_pcoa.R) <br>traitR.fun(df,speciescol,attackedcol,ancspecies,attackedgroup,traitgrp,niter,test="pca",correction=NULL) ###Arguments <br>df: a data frame to use. This is datafile with a row for each individual host plant, and columns for host species identity, presence/absence of each herbivore, and columns for individuals traits measured. <br>speciescol: the column name depicting the insect species <br>attackedcol: the column name designating attacked/unattacked <br>ancspecies: the designator for the ancestral species in speciescol <br>ancspecies: the designator for the attacked level in attackedcol <br>traitgrp: a list of column names giving the traits of interest. Easiest to generate using traitgrp<-list(mydat[,3:7]). <br>niter: number of iteractions <br>test: either "pca" or "pcoa" <br>correction: for negative eigenvalues in pcoa (see ?pcoa) - "none", "lingoes" or "cailliez" ###Details To run the shiny app put server.R, UI.R and traitR_pcoa.R in a folder. Open them in R studio and click run app from either server.R or UI.R <br>Both the shiny app and the standalone will implement a pca for numeric data or a pcoa for a combination of numeric and categorical data. Categorical data can be factors or ordered factors. The pcoa implements the gower dissimilarity gowdis function in the FD package. The pca uses the primcomp function. At present the pca works on scaled and centered data (cor=T in princomp) but not for pcoa. This may be implemented in a later version. ###Value <br>distances The distances between the centroids for attacked and unattacked plants <br>permutations The randomised distances for each permutation <br>pvals The pvalues for the three hypotheses <br>centroid1 The position of the centroid for each species <br>centroid2 The position of the centroid for each attacked/unattacked combination <br>pcscores The scores and the values of the species/attacked columns for the first two PCA axes for plotting <br>loadings The loadings for the PCA. Not implemented for PCOA <br>samp Sample size. ###Author(s) Linley Jesson <p>Chandra Moffat <p>Steve Heard (for the original TraitSpaces)
About
R function for the implementation of TraitSpaces
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published