Learn R Programming

sjPlot (version 1.7)

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 parameter 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(df, describe = TRUE, file = NULL, alternateRowColors = FALSE,
  orderColumn = NULL, orderAscending = TRUE, title = NULL,
  repeatHeader = FALSE, stringVariable = "Variable", showType = FALSE,
  showRowNames = TRUE, showCommentRow = FALSE,
  commentString = "No comment...", hideProgressBar = FALSE,
  encoding = NULL, CSS = NULL, useViewer = TRUE, no.output = FALSE,
  remove.spaces = TRUE)

Arguments

Value

Invisibly returns a structure with
  • 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.

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}
  • view_spss

Examples

Run this code
# init dataset
data(efc)

# plot efc-data frame summary
sjt.df(efc, alternateRowColors=TRUE)

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

# plot efc-data frame summary, ordered descending by mean-column
sjt.df(efc, orderColumn="mean", orderAscending=FALSE)

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

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

# ----------------------------------------------------------------
# User defined style sheet
# ----------------------------------------------------------------
sjt.df(efc,
       alternateRowColor=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