oppsumtabell: Create univariate summary tables

View source: R/oppsumtabell.R

oppsumtabellR Documentation

Create univariate summary tables

Description

This function allows you to create a simple univariate summary table for one or more variables in a dataset. The table will show the following summary statistics: the number of non-missing observations, the average (mean), the median, the 25th and 75th percentiles, the standard deviation, the minimum, the maximum, and the number of missing observations.

Usage

oppsumtabell(
  dataset,
  variables = NULL,
  variable = NULL,
  export = NULL,
  norsk = NULL
)

Arguments

dataset

Your dataset (a data.frame-type object).

variables

The variables from your dataset for which you want summary statistics. Specify them as a string or a string vector.

variable

Alias for variables. One of variable or variables must be used.

export

Should the table be made export-ready (TRUE/FALSE)?

norsk

Results in Norwegian (NB)?

Details

The result can be printed in an "export-ready" fashion, meaning it can be copied and pasted into a Word document and there transformed into a publication-quality table. The function will provide warnings in some cases where user selections might be problematic.

Value

A data.frame or, if export function is switched on (export=TRUE), a printed out table formatted for easy export to MS Word.

Examples

## Not run: 
# Loading mtcars dataset
data(mtcars)

# For a single variable
oppsumtabell(dataset = mtcars, variables = c("cyl"))

# Alternative
oppsumtabell(dataset = mtcars, variables = "cyl")

# For more variables
oppsumtabell(dataset = mtcars,
variables = c("cyl","mpg","disp"))

# Using export function
oppsumtabell(dataset = mtcars,
 variables = "mpg", export = TRUE)

## End(Not run)


cknotz/bst290 documentation built on Nov. 11, 2023, 1 p.m.