nfkc_all: Unicode normalization of data.frame with compatibility...

View source: R/nfkc_all.r

nfkc_allR Documentation

Unicode normalization of data.frame with compatibility equivalence

Description

This is a dplyr-dependent preprocessing function

Usage

nfkc_all(
  .data,
  remove_space_colnames = FALSE,
  remove_space_contents = FALSE,
  coln_spc = "[:blank:]",
  cont_spc = "[:blank:]"
)

Arguments

.data

data.frame-like object (tibble, data.table, etc.)

remove_space_colnames

If TRUE, remove all white spaces from all column names. Default: FALSE.

remove_space_contents

If TRUE, remove all white spaces from all contents. Default: FALSE.

coln_spc

Space character to be removed in colnames.

cont_spc

Space character to be removed in contents.

Value

object of the same class as .data

Examples

 # data.frame
 df <- data.frame(`列1(トン)` = 1, `列2 (kg) ` = 2)
 nfkc_all(df)

 # data.table
 require(data.table)
 dt <- data.table(`列1(トン)` = 1.1, `列2 (kg) ` = 2.1)
 nfkc_all(dt)

 # tibble
 require(tibble)
 tbl <- tibble(`列1(トン)` = "1.2\r\nトン", `列2 (kg) ` = " 2.2\n kg")
 nfkc_all(tbl)
 # remove white-spaces (blanks) from all column names
 nfkc_all(tbl, remove_space_colnames = TRUE)
 # remove white-spaces (blanks) from all contents
 nfkc_all(tbl, remove_space_contents = TRUE)
 # remove all white-spaces (blanks) from .data
 nfkc_all(tbl, remove_space_colnames = TRUE, remove_space_contents = TRUE)

 # remove all spaces (including new line characters) from all contents
 nfkc_all(tbl, remove_space_contents = TRUE, cont_spc = "[:space:]")

JK-junkin/frabento documentation built on Oct. 20, 2023, noon