Learn R Programming

sjPlot (version 2.0.0)

sjt.df: Show (description of) data frame as HTML table

Description

Shows description or the content of data frame (rows and columns) as HTML table, or saves it as file. Helpful if you want a quick overview of a data frame's content. See argument describe for details. By default, describe is TRUE and a description of the data frame is given, using the describe-function of the psych-package.

Usage

sjt.df(mydf, describe = TRUE, altr.row.col = FALSE, sort.col = NULL,
  sort.asc = TRUE, title = NULL, repeat.header = FALSE,
  show.type = FALSE, show.rownames = TRUE, show.cmmn.row = FALSE,
  string.cmmn = "No comment...", string.var = "Variable", big.mark = NULL,
  hide.progress = FALSE, CSS = NULL, encoding = NULL, file = NULL,
  use.viewer = TRUE, no.output = FALSE, remove.spaces = TRUE, ...)

Arguments

Value

Invisibly returns
  • the data frame with the description information (data),
  • the web page style sheet (page.style),
  • the web page content (page.content),
  • the complete html-output (output.complete) and
  • the html-table with inline-css for use with knitr (knitr)
for further use.

Details

See 'Details' in sjt.frq.

See Also

  • http://www.strengejacke.de/sjPlot/datainit/{sjPlot manual: data initialization}
  • http://www.strengejacke.de/sjPlot/view_spss/{sjPlot manual: inspecting (SPSS imported) data frames}

Examples

Run this code
# init dataset
library(sjmisc)
data(efc)

# plot efc-data frame summary
sjt.df(efc, altr.row.col = TRUE)

# plot content, first 50 rows of first 5 columns of example data set
sjt.df(efc[1:50, 1:5], describe = FALSE, string.var = "Observation")

# plot efc-data frame summary, sorted descending by mean-column
sjt.df(efc, sort.col = "mean", sort.asc = FALSE)

# plot first 20 rows of first 5 columns of example data set,
# sort by column "e42dep" with alternating row colors
sjt.df(efc[1:20, 1:5], altr.row.col = TRUE, 
       sort.col = "e42dep", describe = FALSE)

# plot first 20 rows of first 5 columns of example data set,
# sorted by 4th column in descending order.
sjt.df(efc[1:20, 1:5], sort.col = 4, sort.asc = FALSE, describe = FALSE)

# add big mark to thousands
library(datasets)
sjt.df(as.data.frame(WorldPhones), big.mark = ",")

# User defined style sheet
sjt.df(efc, altr.row.col = TRUE, 
       CSS = list(css.table = "border: 2px solid #999999;",
                  css.tdata = "border-top: 1px solid;",
                  css.arc = "color:blue;"))

Run the code above in your browser using DataLab