View source: R/prepare_ext_obs_table.R
| prepare_ext_obs_table | R Documentation | 
Reads a data frame, sorts it by the given variable and displays the top and bottom n observations.
prepare_ext_obs_table(
  df,
  n = 5,
  cs_id = NULL,
  ts_id = NULL,
  var = utils::tail(colnames(df[sapply(df, is.numeric) & (!colnames(df) %in% c(cs_id,
    ts_id))]), n = 1),
  ...
)
| df | Data frame | 
| n | The number of top/bottom observations that you want to report. | 
| cs_id | The variable(s) identifying the cross-section in the data. | 
| ts_id | The variable identifying the time-series in the data. | 
| var | Variable to display. Defaults to the last numerical variable of the data frame. | 
| ... | Additional parameters that are passed to  | 
When both cs_id and ts_id are omitted, all variables are tabulated.
Otherwise, var is tabulated along with the identifiers.
Infinite values in var are omitted.
The default parameters for calling kable,
are format = "html", digits = 3, format.args = list(big.mark = ','), row.names = FALSE.
A list containing two items:
A data frame containing the top/bottom n observations
The return value provided by kable containing the formatted table
t <- prepare_ext_obs_table(russell_3000, n = 10,
                           cs_id = c("coid", "coname"),
                           ts_id = "period", var = "sales")
t$df
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.