On 2013-03-06 07:49, Nicole Thompson wrote:
Hello,
I'm doing a comparative analysis of mammal brain and body size data.
I'm following Charlie Nunn and Natalie Cooper's instructions for
"Running PGLS in R using caper".
I run into the following error when I create my comparative dataset,
combining my phylogenetic tree (mammaltree) and taxon measures
(mammaldata):
"Error in phy$node.label[which(newNb > 0) - Ntip] : only 0's may be
mixed with negative subscripts"
My full script is provided at the bottom.
I have looked at the caper manual by David Orme to understand how
comparative.data() constructs the dataset, but still cannot interpret
the error. Many thanks to anyone who could provide me with insight.
Nicole Thompson
E3B Columbia University
library(caper)
Loading required package: ape
Loading required package: MASS
Loading required package: mvtnorm
mammaldata <-read.csv("R.Mammal_data.csv", header = TRUE)
mammaltree <-read.nexus("BEphylotree.nex")
mammal <- comparative.data(phy = mammaltree, data = mammaldata, names.col =
Taxon, vcv = TRUE, na.omit = FALSE, warn.dropped = TRUE) #names.col?
Error in phy$node.label[which(newNb > 0) - Ntip] : only 0's may be
mixed with negative subscripts
Looks to me like 'which(newNb > 0) - Ntip' evaluates to a
vector that has both positive and negative elements.
Like this:
x <- 1:5
x[c(-2,-4)] ## ok
x[c(-2, 0)] ## ok
x[c(-2, 4)] ## generates your error
Peter Ehlers
--
Nicole A Thompson
E3B Columbia University, NYCEP
nat2...@columbia.edu
480.522.4212
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.