[R] R neophyte question.

Ben Bolker bolker at ufl.edu
Wed Oct 14 22:10:15 CEST 2009


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)?]




More information about the R-help mailing list