Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

utf8_encoding

Use UTF-8 for character encoding in a data frame


Description

fread from data.table could not recognize the encoding and return the correct form, this could be unconvenient for text mining tasks. The utf8-encoding could use "UTF-8" as the encoding to override the current encoding of characters in a data frame.

Usage

utf8_encoding(.data, .cols)

Arguments

.data

A data.frame.

.cols

The columns you want to convert, usually a character column.

Value

A data.table with characters in UTF-8 encoding

Examples

iris %>%
  as.data.table() %>%
  utf8_encoding(Species)  # could also use `is.factor`

tidyft

Tidy Verbs for Fast Data Operations by Reference

v0.4.5
MIT + file LICENSE
Authors
Tian-Yuan Huang [aut, cre] (<https://orcid.org/0000-0002-3591-4203>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.