leghead | R Documentation |
'leghead' is part 'head' and part 'summary'. It works best on a sorted dataframe where all you are interestesd in only the most (or least) abundant rows. An ideal place to use it is in a legend for ~lognormally distributed data. Additionally, an optional row-wise color coding column is added (the color 'gray' is used for missing row names).
leghead(x, n=7, tabulate=FALSE, colors=TRUE, na.name='NA',
na.col = "white", other.col = "gray", na.last = TRUE)
x |
dataframe or table you wish to summarize |
n |
the number of rows you wish to display as is |
colors |
list of vectors or a dataframe |
tabulate |
the column name to tabulate on if x is an untabulated dataframe and FALSE otherwise |
na.name |
the new rowname for a row with a missing name |
na.col |
color for rows labeled as 'NA' |
other.col |
color for the rows labeled as 'unknown' |
na.last |
boolean specifying if the na category should be listed last in the table. |
A truncated dataframe with a new bottom row summarizing all the truncated ones.
summary, head, sstable
e <- data.frame(a=runif(12),b=runif(12), z=rep(letters[13:18],2),w=rep(letters[20:23],3))
tab <- sstable(e, idx.clmns=c('z'), ct.clmns=c('a','b'))
lh <- leghead(tab)
plot(x=lh$a, y=lh$b, cex=lh$sum*3, col=lh$color, pch=20)
legend('topleft',legend=rownames(lh), col=lh$color, pch=20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.