Try using melt
and then dcast
library(reshape2)
dcast(melt(habitat), ...~habitat)
Here's part of the output:
zone variable Beaches, dunes, sands Intertidal flats Natural grasslands
1 dark proportion NA 0.756 0.050
2 light proportion 0.005 0.810 0.011
You can get rid of variable
by using a simple subseting
dcast(melt(habitat), ...~habitat)[, -2]