ksic_group: Extract Parent KSIC Codes

View source: R/ksic_group.R

ksic_groupR Documentation

Extract Parent KSIC Codes

Description

Extracts the parent classification codes corresponding to the input KSIC codes. It can handle a vector containing codes with different numbers of digits.

Usage

ksic_group(ksic, digit = 1, C = NULL, name = FALSE)

Arguments

ksic

character. A vector of KSIC codes to find parent codes for.

digit

integer. The digit of the parent classification to extract (1-5). Default is 1.

C

integer. The KSIC revision (9, 10, or 11). If NULL, getOption("ksic.C", 11) is used.

name

logical. If TRUE, returns names; if FALSE, returns codes. Default is FALSE.

Value

A character vector of the same length as the input vector, containing parent codes or names. Returns NA if a parent code does not exist.

Examples

ksic_group(c("31311", "4631", "25", "A"), digit = 2, name = TRUE)

ksic_group("26222", digit = 4)

KSIC documentation built on Aug. 18, 2025, 5:36 p.m.