View source: R/make.countarray.R
| make.countarray | R Documentation |
mdf object for all traitpairs in the supplied list of traits.
For some of the traits in a dataframe or an mdf object there may be missing observations, coded as NA, on some individuals. The function make.countarray assembles an array containing observation counts for all pairs of traits from the supplied vector of trait names.
make.countarray(mdf, traits)
mdf |
A dataframe or an object of class |
traits |
A vector of the names of traits given as character strings |
This function may be useful if the number of observations varies between traits and one is planning to do a dmm() analysis with either the traitspairwise or traitsblockwise option.
An array object with 2 dimensions, both of size equal to the number of traits in argument traits. Rows and columns are labelled with trait names. Each element is a count of the number of observations not equal to NA for a pair of traits.
Neville Jackson
Functions dmm(), mdf()
library(dmm)
# prepare the dataset sheep.df
data(sheep.df)
# count the observations
countarray <- make.countarray(sheep.df,c("Cww","Diam","Bwt"))
# lookat the counts
print(countarray)
#cleanup
rm(sheep.df)
rm(countarray)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.