Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201894

R: Sum each column, average cover value and relative average cover value

$
0
0

I have a dataframe that contains percent cover data of many plant species in several plots:

Example

        sp1 sp2 sp3 sp4
PlotA   1   12  0   0
PlotB   0   3   5   0
PlotC   3   0   0   1
PlotD   0   6   0   0
PlotE   1   1   0   0

I would like to calculate a few things for each individual species/column:

How many plots does each species occur? (ex. sp1 = 3, sp2 = 4, sp3 = 1)

What is the average pct. cover per species per plot? (total cover/total plots, ex. sp1 = 1.0, sp2 = 4.4)

What is the relative avg. pct. cover per species per plot? (avg. pct. cover/sum of all avg. pct cover)

Will this be more easily achieved by making the species the rows and the plots the columns?


Viewing all articles
Browse latest Browse all 201894

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>