statar (version 0.2)

graph: Experimental function to graph a dataset

Description

Experimental function to graph a dataset

Usage

graph(x, ..., along_with = NULL, by = NULL, w = NULL, reorder = TRUE,
  winsorize = TRUE, facet = FALSE, verbose = FALSE, type = if
  (is.null(substitute(along_with))) {     "density" } else {     if
  (is.null(formula))          "loess"     else "felm" }, formula = NULL,
  n = 20)

graph_(x, ..., .dots, along_with = NULL, by = NULL, w = NULL, reorder = TRUE, winsorize = TRUE, facet = FALSE, verbose = FALSE, type = if (is.null(along_with)) { "density" } else { if (is.null(formula)) "loess" else "felm" }, formula = NULL, n = 20)

Arguments

x
A data.table.
...
Variables to include. Defaults to all non-grouping variables. See the select documentation.
along_with
A variable that specifies the x axis. Should be specified when "type" is "line", "lm" or "loeless".
by
Groups within which variables should be ploted.
w
Analytical weights (experimental)
reorder
Should the category with the most count be printed first?
winsorize
Should variables winsorized?
facet
Should different groups graphed in different windows?
verbose
Should warnings (regarding missing values, outliers, etc) be printed?
type
type of graph among "density", "boxplot", "line", or a statistical method (like "lm", "loeless" or "felm")
formula
to use then type is "felm"
n
Number of quantiles to plot
.dots
Used to work around non-standard evaluation.

Examples

Run this code
library(data.table)
N <- 1e2
DT <- data.table(
  id = sample(c("id1","id2","id3"), N, TRUE),
  v1 = sample(c(1:5), N, TRUE),
  v2 = rnorm(N, sd = 20),
  v3 = sample(runif(100, max=100), N, TRUE)
)
DT[, v4 := v3 + rnorm(N, sd = 20)]
graph(DT)
graph(DT, by = id)
graph(DT, by = id, facet = TRUE)
graph(DT, by = id, type = "boxplot")
graph(DT, v3, along_with = v2, by = id, type = "loess")

Run the code above in your browser using DataLab