clean_names: clean_names

Description Usage Arguments Value Examples

View source: R/clean_names.R

Description

Alternative zu janitor Quelle https://drdoane.com/clean-consistent-column-names/

clean_names Input data.frame output ist ein data.frame mit bereinigten namen.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
clean_names(x, ...)

## S3 method for class 'data.frame'
clean_names(data, label = TRUE, labels = NULL, ...)

## Default S3 method:
clean_names(
  x,
  tolower = TRUE,
  unique = TRUE,
  abbreviate = FALSE,
  minlength = 4,
 
    replace = c(`'` = "", `"` = "", `%` = "_pct", `#` = "_cnt", ä = "ae", ü = "ue", ö = "oe", Ü = "Ue", Ä = "Ae", Ö = "Oe", ß = "ss", `¨` = "", `&+` = "_and_", `@+` = "_at_", `_` = ".")
)

Arguments

x
data

data.frame oder character

tolower
unique
abbreviate, minlength

Abbkürzung

minlength
replace
abbreviate

Value

die selbe Klasse wie der Input

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
clean_names(tibble::tibble("Öli"=1:3, "p-k"=1:3, "95%-CI"=4:6) )

c(
  c(
    "  a", "a  ", "a %", "a",
    "$a", "$$$a", "GDP ($)",
    "GDP (us$)", "a (#)", "a & b",
    "#", "$", "a_cnt", "Aa&Bb",
    "camelCasePhrases", "AlphaBetaGamma",
    "Alpha       Beta", "Beta  !!! Gamma",
    "a + b", "a - b", "a * b", "Ösel"
  ), abbreviate=TRUE
)




df <- data.frame(
Öse = c(1, 2, 3, 1, 2, 3),
Löre = gl(2, 3, labels = c("Amy", "Bob")),
Fürn = c(9, 7, 6, 8, 6, 9),
Mäße = c(6, 7, 8, 5, 6, 7),
hüne=c(1, 2, 3, 1, 2, 3)
)


clean_names(df)

stp4/stp25aggregate documentation built on Sept. 17, 2021, 5:34 a.m.