Reputation: 3
I am trying to see if the use of different habitats has an effect in the infestation level in a certain host population. Therefore, my dependent variable is Parasitation
, with the value "0" if the individual wasn't parasitized and "1" if it was, and my response variable is Habitat ("Bamboo", "Open", "Rhododendron"). I also have the covariable "Year" (the samples were different from year to year).
I consulted The R book" by Michael J Crawley and saw that, for my case, the best would be to perform a contingency table analysis (Chapter 15), using a glm with poisson distribution. For my despair, I am not being able to correctly import/ build the contingency table in R, becasuse it isn't 2 by 2.
I tried to build this in excel and saved it as a csv and also as a txt. But I am falling to correclty import the table.
I would like R to read the table as in the image
enter image description here
I used this code
ct2 <- read.csv("C:\\Users\\Asus R541u\\Desktop\\Master Thesis\\R3\\Habitatuse\\Ct.csv", header = T, sep = ",")
and obtained this enter image description here
I tried other codes, but they didn't worked aswell. Can you please tell me how to correctly import the table form the first image? Or if there is a way for R to read this as a matrix or something that I can actually perform the analysis?
Upvotes: 0
Views: 34