Learn R Programming

translateSPSS2R (version 1.0.0)

computeChar_mblen: Byte per character or sign

Description

Helper Function for xpssCompute. R Implementation of the SPSS CHAR.MBLEN Function.

Usage

computeChar_mblen (x,pos = NULL)

Arguments

x
character vector, or a vector to be coerced to a character vector. Giving a factor is an error.
pos
position of character or sign the number of bytes return to.

Value

Numeric. Returns the number of bytes in the character at position pos in x.

Details

Important for Asian languages, where a character can fill more than one byte.

See Also

nchar

Examples

Run this code
#Returns 1 cause the letter "R" fills one byte.
xpssCompute(x="R is great!", fun="computeChar_mblen", pos=2)

Run the code above in your browser using DataLab