translate: Translate between classifications.

Description Usage Arguments Details Value Examples

Description

Translate between classifications, based on a concordance.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
translate(object, concordance, to = NULL, ...)

## S4 method for signature 'ANY,ManyToOne,missing'
translate(object, concordance)

## S4 method for signature 'ANY,ManyToOne,ANY'
translate(object, concordance, to)

## S4 method for signature 'ANY,OneToOne,ANY'
translate(object, concordance, to = NULL)

## S4 method for signature 'ANY,OneToOne,'NULL''
translate(object, concordance, to = NULL)

## S4 method for signature 'ANY,OneToOne,missing'
translate(object, concordance)

## S4 method for signature 'ANY,data.frame,ANY'
translate(object, concordance, to = NULL, ...)

## S4 method for signature 'ANY,matrix,ANY'
translate(object, concordance, to = NULL, ...)

Arguments

object

A character vector.

concordance

An object of class Concordance.

to

Name of classification within concordance that codes from object should be translated to.

...

Not currently used.

Details

If concordance is ManyToOne, then object must be the 'many' part, and argument to is not required. If concordance is OneToOne, and to is not supplied, translate guess, based on the values in object.

Value

A character vector, the same length as object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
conc <- data.frame(code = 1:3,
                   descriptor = c("North Island", "South Island",
                                   "Stewart Island"))
conc <- Concordance(conc)
conc
translate(c("1", "3", "1", "2"),
          concordance = conc)
translate(c("Stewart Island", "North Island"),
          concordance = conc)


codes(conc, classification = "code")
codes(conc, classification = "descriptor")

conc <- data.frame(sex1 = c("girl", "boy", "woman", "man"),
                   sex2 = c("female", "male"))
conc <- Concordance(conc)
conc
translate(c("man", "girl"), concordance = conc)
## Not run: 
translate(c("female", "male"), concordance = conc)

## End(Not run)

StatisticsNZ/classconc documentation built on May 9, 2019, 2:03 p.m.