Description Usage Arguments Details Value Examples

View source: R/LineChart-functions.R

This function creates a data frame that can be used for plotting
from a user-supplied data frame. The user data will be aggregated
based on the formula. The resulting plotting data frame can be used
with `lineChartDf`

.

1 2 | ```
createPlottingDf(formula, data, settings = NULL,
centralTendencyType = "mean", errBarType = "SE", xOrder = NULL)
``` |

`formula` |
The formula should be of the form |

`data` |
A data frame containing the data to be used in creation of the plotting data frame. |

`settings` |
Plotting settings for the different groups in the data, such as the symbol to use. |

`centralTendencyType` |
Character or function. The type of central tendency measure to use. Can be "mean" or "median". If a function, should be a function of one vector argument that returns a scalar. |

`errBarType` |
The type of error bar to use. Can be "SE" for standard error, "SD" for standard deviation, or "CI95" for a 95% confidence interval. If NULL, no error bars are created. If a function is supplied, the function should take one vector argument, which is the data used to plot a single data point. It should return either 1) a length-2 vector or 2) a list with two elements. If returning 1), the values in the vector should be distances from the central tendency measure that the error bars should be drawn (i.e. they should be more-or-less centered on 0). If returning 2), the list should contain |

`xOrder` |
The order in which to plot the x variable. A character vector containing all of the levels of the x variable in the order in which they should be plotted. If the |

Note that if no grouping variables are supplied by the formula, a `group`

column
will still be made in the resulting data frame and the group name will be the number 0.

A data frame which can be plotted with `lineChartDf`

. See the documentation for lineChartDf for examples.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
data(ChickWeight)
#Example of a user-defined central tendency function:
trimmedMedian = function(x) {
#trim highest and lowest values
x = sort(x)[ 2:(length(x) - 1) ]
median(x)
}
#Example of a user-defined error bar function:
quartiles = function(x) {
qs = as.numeric(quantile(x, c(0.25, 0.75)))
list(eb=qs, includesCenter=TRUE)
}
plotDf = createPlottingDf(weight ~ Time * Diet, ChickWeight,
centralTendencyType=trimmedMedian, errBarType=quartiles)
lineChartDf(plotDf)
``` |

hardmanko/LineChart-package documentation built on Oct. 8, 2017, 2:57 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.