PrintPlots: Create a pdf file with plots and compute summary statistics...

Description Usage Arguments Value License See Also

View source: R/plot_print.R


Creates plots and outputs results to a letter-sized pdf file, with each individual page containing plots on a single variable in the data. In addition, two summary statistics data.table are returned, one for numerical variables, and one for categorical (and binary) ones.


PrintPlots(outFl, dataFl, sortVars, dateNm, dateGp, dateGpBp, weightNm = NULL,
  labelFl = NULL, genCSV = TRUE, highlightNms = NULL, skewOpt = NULL,
  kSample = 50000, fuzzyLabelFn = NULL, kCategories = 9)



Name of the output file, with no extension names (e.g., "bank"). A pdf file of plots ("bank.pdf"), and two csv files of summary statistics ("bank_categorical_summary.csv" and "bank_numerical_summary.csv") will be saved to your working directory, unless a path is included in outFl (e.g. "../plots/bank").


A data.table containing at least the following columns: myVar, weightNm, dateGp, dateGpBp; usually an output of the PrepData function.


A character vector of variable names in the order they will be plotted.


Name of column containing the date variable.


Name of the variable that the time series plots should be grouped by. Options are NULL, "weeks", "months", "quarters", "years". See IDate for details. If NULL, then dateNm will be used as dateGp.


Name of variable the boxplots should be grouped by. Same options as dateGp. If NULL, then dateGp will be used.


Name of the variable containing row weights, or NULL for no weights (all rows receiving weight 1).


A data.table containing variable labels, or NULL for no labels; usually an output of PrepLabels.


Logical, whether to generate the two csv files of summary statistics for numerical and categorical variables.


Either NULL or a character vector of variables to recieve red label. Currently NULL means all variables will get a black legend. Ignored this argument if labelFl == NULL.


Either a numeric constant or NULL. Default is NULL (no transformation). If numeric, say 5, then all box plots of a variable whose skewness exceeds 5 will be on a log10 scale if possible. Negative input of skewOpt will be converted to 3.


Either NULL or a positive integer. If an integer, indicates the sample size for both drawing boxplots and ordering numerical graphs by R^2. When the data is large, setting kSample to a reasonable value (default is 50K) dramatically improves processing speed. Therefore, for larger datasets (e.g. > 10 percent system memory), this parameter should not be set to NULL, or boxplots may take a very long time to render. This setting has no impact on the accuracy of time series plots on quantiles, mean, SD, and missing and zero rates.


Either NULL or a function of 2 parameters: A label file in the format of an output by PrepLabels and a string giving a variable name. The function should return the label corresponding to the variable given by the second parameter. This function should describe how fuzzy matching should be performed to find labels (see example below). If NULL, only exact matches will be retuned.


If a categorical variable has more than kCategories, trace plots of only the kCategories most prevalent categories are plotted.


A pdf of plots saved to file outFl.pdf, and if the argument genCSV == TRUE, also two csv files of summary statistics for numerical and categorical variables.


Copyright 2017 Capital One Services, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

See Also

Functions depend on this function: vlm.

This function depends on: PlotVar, PrepData.

otvPlots documentation built on May 1, 2019, 6:49 p.m.