as.LongTriangle | R Documentation |
Given a Triangle in matrix ("wide") format, convert to data.frame ("long") format.
as.LongTriangle(Triangle, varnames = names(dimnames(Triangle)),
value.name = "value", na.rm = TRUE)
Triangle |
a loss "triangle". Must be a |
varnames |
|
value.name |
column name to be given to the matrix values that will be stored in the data.frame. Defaults to "value". |
na.rm |
should NA values be excluded from the data.frame? Defaults to TRUE. |
Unlike the as.data.frame.triangle method, and Unlike the 'melt' method in the 'reshape2' package, this function returns a data.frame where the rownames and colnames of Triangle are stored as factors. This can be a critical feature when the order of the levels of the columns is important. For example, when a Triangle is plotted, the order of the origin and dev dimensions is important. See Examples section.
A data.frame
.
Daniel Murphy
as.data.frame.triangle
as.LongTriangle(GenIns)
## Not run:
ggplot(as.LongTriangle(GenIns),
aes(x = dev, y = value, group = origin, color = origin)) + geom_line()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.