Hi, Last week my class conducted an experiment by putting out clay caterpillars to look at the effects of urbanization, color, and location on caterpillar predation. There were two sites (urban, rural), three colors (green, yellow, red) and two locations at each site (edge, interior). The entire data set is below. I've checked out the MASS book, Dalgaard's book, and the R-help archives and I haven't found anything that suggests how to set up a spreadsheet for the xtab function (say, xtab(predation ~ location + site + color, data=class). It would not be a problem to input the data by hand but I wouldn't know how to set that up either. Any suggestions would be greatly appreciated. The class is mostly college sophmores and juniors and biology and education majors. We are using R 2.2.1 on Windows XP. Again, many thanks, Jeff site location color predated Urban Edge Green 5 Urban Edge Red 30 Urban Edge Yellow 11 Urban Interior Green 11 Urban Interior Red 22 Urban Interior Yellow 22 Rural Edge Green 94 Rural Edge Red 40 Rural Edge Yellow 67 Rural Interior Green 40 Rural Interior Red 70 Rural Interior Yellow 33 **************************************** Jeffrey A. Stratford, Ph.D. Postdoctoral Associate 331 Funchess Hall Department of Biological Sciences Auburn University Auburn, AL 36849 334-329-9198 FAX 334-844-9234 auburn.edu/~stratja
Jeffrey Stratford wrote:> Hi, > > Last week my class conducted an experiment by putting out clay > caterpillars to look at the effects of urbanization, color, and location > on caterpillar predation. There were two sites (urban, rural), three > colors (green, yellow, red) and two locations at each site (edge, > interior). The entire data set is below. I've checked out the MASS > book, Dalgaard's book, and the R-help archives and I haven't found > anything that suggests how to set up a spreadsheet for the xtab function > (say, xtab(predation ~ location + site + color, data=class). It would > not be a problem to input the data by hand but I wouldn't know how to > set that up either. Any suggestions would be greatly appreciated. The > class is mostly college sophmores and juniors and biology and education > majors. We are using R 2.2.1 on Windows XP. >Hi Jeff, For some unknown reason, you used the name of a function that I wrote some years ago that may do what you want. Just call it the way you have above and it should work. Jim -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: xtab.R Url: stat.ethz.ch/pipermail/r-help/attachments/20060206/08f342cd/xtab.pl -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: xtab.Rd Url: stat.ethz.ch/pipermail/r-help/attachments/20060206/08f342cd/xtab-0001.pl