str_conv: Specify the encoding of a string.

Description Usage Arguments Examples

Description

This is a convenient way to override the current encoding of a string.

Usage

1
str_conv(string, encoding)

Arguments

string

String to re-encode.

encoding

Name of encoding. See stringi::stri_enc_list() for a complete list.

Examples

1
2
3
4
5
# Example from encoding?stringi::stringi
x <- rawToChar(as.raw(177))
x
str_conv(x, "ISO-8859-2") # Polish "a with ogonek"
str_conv(x, "ISO-8859-1") # Plus-minus

Example output

[1] "\261"
[1] "<U+0105>"
[1] "<U+00B1>"

stringr documentation built on May 2, 2019, 11:03 a.m.