Katie Miller <bioprogrammer <at> gmail.com> writes: > > Hi all, > > I'm currently working through the "Beginner's Guide to R" (Zurr et al.) and > I'm wondering about the first exercise in chapter 3: >
[snip] > I don't know how to obtain the answers for 'Which country has had the most > cases?', 'Which country has had the least bird flu deaths?' or (using > methods from chapter 2), 'What is the total number of bird flu cases per > country?' and 'What is the total number of cases per year?' > > The rowSums and colSums functions haven't been introduced at this point in > the text. Can you assure us this isn't a homework assignment? The authors have introduced matrix indexing, so what about sum(Bird[,2]), sum(Bird[,3]), ... [or apply(Bird[,-1],2,sum)?] ______________________________________________ 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.