Dear all, 

   I am having a recurring problem when I attempt to conduct a GLM.  Here is 
what I am attempting (with fake data): 
First, I created a txt file, changed the directory in R (to the proper folder 
containing the file) and loaded the file: 

#avoid<-read.table("avoid.txt",header=TRUE);avoid 
#  treatment feeding avoid noavoid 
#1   control  nofeed     1     357 
#2   control    feed     2     292 
#3   control     sat     4     186 
#4      proc  nofeed    15     291 
#5      proc    feed    25     288 
#6      proc     sat    17     140 
#7       mag  nofeed    87     224 
#8       mag    feed    34     229 
#9       mag     sat    46     151 

I then try to "attach(avoid)" the data, but continue to get an error message ( 
The following object(s) are masked _by_ .GlobalEnv :), so to fix this, I do the 
following: 

#newavoid<-avoid 
#newavoid                (does this do anything?) 

Lastly, I have several GLM's I wanted to conduct.  Please see the following: 

#model1<-glm(cbind(avoid, noavoid)~treatment,data=,family=binomial) 

#model2=glm(cbind(avoid, noavoid)~feeding, familiy=binomial) 

#model3=glm(cbind(avoid, noavoid)~treatment+feeding, familiy=binomial) 

After running model1, I receive the error message "Error in 
model.frame.default(formula = cbind(avoid, noavoid) ~ treatment,  : 
  invalid type (list) for variable 'cbind(avoid, noavoid)'".  

It would be greatly appreciated if somebody can help me with my coding, as you 
can see I am a novice but doing my best to learn.  I figured if I can get 
model1 to run, I should be able to figure out the rest of my models.  

Kind Regards! 



        [[alternative HTML version deleted]]

______________________________________________
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