r - create presence-absence table by different attributes -


i have big dataset table of species detections in different locations (12 villages consisting out of 4 blocks each - 9 points per blocks). need create presence/absence tables each block (48 blocks = 12 * 4) species combined, each species group/guild (in total 20 groups). in total 48*20=960 tables. in excel pivot table accomplish this, isnt there faster way r?

my table column looks this:

mydata <- structure(list(sample = c("1", "2", "3", "7", "8", "9", "13", "14", "15"),                       block = c("a", "a", "a", "b", "b","b", "a","a", "a"),                       location = c("be", "be", "be", "be", "be", "be", "be", "be", "be"),                                   species = c("a","d","r","a","c","r","a","c", "c"),                      guild1 = c("o", "h", "h","o","i","h","o","i","i")),                  .names = c("sample", "block", "location", "species", "guild1"),                  class = "data.frame", row.names = c(na, -3l)) 

the expected output data should presence/absence samples in rows , species in columns. each block location , guild separate table location should established. prepared, can read data program estimates estimate species richness.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -