Sum up counts in a data.frame grouped by multiple variables
You can do this using the xtabs function! Here's how I did it using your example data:

# Create example data...
name &lt;- c("Maria", "Thomas", "Maria", "Maria", "Thomas", "Maria")
sex &lt;- c("f", "m", "m", "f", "m", "m")
count &lt;- c(97, 12, 5, 97, 8, 4)
data &lt;- data.frame("name"=name, "sex"=sex, "count"=count)

# Create table...
xtabs(formula=count~name + sex, data=data)


which gives the following output:

        sex
name       f   m
Maria    194   9
Thomas     0  20