MakeFreq: Microdata frequency data conversion

View source: R/MakeFreq.R

MakeFreqR Documentation

Microdata frequency data conversion

Description

Microdata frequency data conversion

Usage

MakeFreq(x, freqName = "freq", all = FALSE, hierarchies = FALSE)

MakeMicro(x, freqVar)

Arguments

x

A data frame

freqName

Name of new frequency variable in output data

all

Whether to include level combinations not in microdata (zero frequency)

hierarchies

Whether to treat hierarchical variables automatically when all=TRUE

freqVar

The frequency variable in input data, name or number.

Value

A data frame

Examples

z <- SSBtoolsData("sprt_emp")[c(1, 2, 4, 7:12, 15, 17, 18), -4]
z$eu <- z$geo != "Iceland"
z

MakeFreq(z)
MakeFreq(z[, -2])
MakeFreq(z[, -(2:3)])
MakeFreq(z[, -1])
MakeFreq(z[, -1], all = TRUE)

x <- MakeFreq(z[, -1], all = TRUE, hierarchies = TRUE)
x

MakeMicro(x, "freq")

SSBtools documentation built on Oct. 30, 2024, 5:09 p.m.

Related to MakeFreq in SSBtools...