sdc_descriptives: Disclosure control for descriptive statistics

Description Usage Arguments Value Examples

View source: R/sdc_descriptives.R

Description

Checks if your descriptive statistics comply to statistical disclosure control. Checks for number of distinct entities and dominance.

Usage

1
2
3
4
5
6
7
sdc_descriptives(
  data,
  id_var = getOption("sdc.id_var"),
  val_var = NULL,
  by = NULL,
  zero_as_NA = NULL
)

Arguments

data

data.frame from which the descriptive statistics are calculated.

id_var

character The name of the id variable. Defaults to getOption("sdc.id_var") so that you can provide options(sdc.id_var = "my_id_var") at the top of your script.

val_var

character vector of value variables on which descriptive statistics are computed.

by

character vector of grouping variables.

zero_as_NA

logical If TRUE, zeros in 'val_var' are treated as NA.

Value

A list of class sdc_descriptives with detailed information about options, settings, and compliance with the criteria distinct entities and dominance.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
sdc_descriptives(
  data = sdc_descriptives_DT,
  id_var = "id",
  val_var = "val_1"
)

sdc_descriptives(
  data = sdc_descriptives_DT,
  id_var = "id",
  val_var = "val_1",
  by = "sector"
)

sdc_descriptives(
  data = sdc_descriptives_DT,
  id_var = "id",
  val_var = "val_1",
  by = c("sector", "year")
)

sdc_descriptives(
  data = sdc_descriptives_DT,
  id_var = "id",
  val_var = "val_2",
  by = c("sector", "year")
)

sdc_descriptives(
  data = sdc_descriptives_DT,
  id_var = "id",
  val_var = "val_2",
  by = c("sector", "year"),
  zero_as_NA = FALSE
)

sdcLog documentation built on July 22, 2021, 5:06 p.m.