Displaying 1 result from an estimated 1 matches for "yllperdth".
2004 Apr 15
1
tapply() and barplot() help files for 1.8.1
...In the part of the code that has changed I use tapply() to summarise
some data and then plot it with barplot(). I now have to use matrix()
on the output of tapply() before using barplot() because tapply()
produces a list and barplot() wants a vector or matrix.
In the code below, z is a dataframe, yllperdth is a numeric and fld
is the name of a factor, both in the dataframe.
Old version (as used with R 1.8.1):
## Calculate the % of YLLs for each group in the cause classification.
x <- tapply(z$yllperdth, z[, fld], sum)
totalYLLs <- sum(x)
x <- x / totalYLLs * 100
x <- sort(x)...