I am very very new to R. My problem is that I have a database where I want to select 3 columns:
| Flower color | Insect Species who visit the flower | Number of insects | 
|---|---|---|
| White | A. mellifera | 3 | 
| White | B. terrestris | 1 | 
| Yellow | X. violacea | 2 | 
| Yellow | A. mellifera | 5 | 
| Purple | X. violacea | 10 | 
I want to test if these species have a preference for flowers. So I want to build a table which looks like that:
| Flower color | A. mellifera | B. terrestris | X. violacea | 
|---|---|---|---|
| White | 3 | 1 | 0 | 
| Yellow | 5 | 0 | 2 | 
| Purple | 0 | 0 | 10 | 
But I don't know how, I tried using "fill" argument in table() function, but it displays 1 table for each "number of insects" data that I have.