Hi,

I am trying to assemble a three-way contingency table examining the 
presence/absence of mussels, water depth (Depth1 and Depth 2) and water 
velocity (Flow vs. No Flow). I have written the following code listed below; 
however, when run the glm I get the following message, "Error in 
model.frame.default(formula = Count ~ MP + wd + wv, drop.unused.levels = TRUE) 
: variable lengths differ (found for 'MP')". This may be something simple, if 
so I apologize. Any help would be greatly appreciated.

Best,
C.R.

numbers <- c(1134,956,328,529,435,599,27,99)
dim(numbers) <- c(2,2,2)
numbers
dimnames(numbers)[[3]] <-list("Mussels", "No Mussels")
dimnames(numbers)[[2]] <- list("Flow", "No Flow")
dimnames(numbers)[[1]] <- list("Depth1", "Depth2")
ftable(numbers)
as.data.frame.table(numbers)
frame <- as.data.frame.table(numbers)
names(frame) <- c("wd", "wv", "MP", "Count")
frame
attach(frame)
model1 <- glm(Count~MP+wd+wv,poisson)
______________________________________________
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.

Reply via email to