View source: R/string-clean-names.R
clean_names | R Documentation |
Alternative zu 'janitor' Quelle https://drdoane.com/clean-consistent-column-names/
clean_names2() ist eine einfachere Variante von clean_names(). Die Funktion gibt es nur für Vektoren. Die Umlaute werden nicht mit Ue oder oe übersätzt.
clean_names(): Input data.frame output ist ein data.frame mit bereinigten namen.
paste_names: paste names
paste_names_levels: paste names + Labels Die funktion ist gedacht für Copy and Paste.
cleansing_umlaute(): Funktion entfernt stoerende Umlaute, unten stehende Liste ggf. erweitern.
cleansing_umlaute2: Sonderzeichen aus socisurvy
clean_names(x, ...)
clean_names2(
x,
tolower = TRUE,
abbreviate = TRUE,
minlength = 25,
replace = c(`%` = "_pct", `#` = "_cnt", `¨` = "", `&+` = "_and_", `@+` = "_at_", `_`
= ".")
)
## S3 method for class 'data.frame'
clean_names(
x,
label = TRUE,
labels = NULL,
cleanup.encoding = FALSE,
from = "UTF8",
to = "latin1",
...
)
## 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_", `_` = "."),
...
)
paste_names(x, collapse = ", ", ...)
paste_names_levels(x, abbreviate = TRUE, collapse = ", ", ...)
cleansing_umlaute(x, ...)
cleansing_umlaute2(x, ...)
abbreviate2(x, minlength = 4)
x |
string |
... |
alles |
tolower |
alles zu kleinbuschstaben |
abbreviate , minlength |
Abbkürzung |
replace |
named character string |
label , labels |
label |
cleanup.encoding , from , to |
logical UTF-8 to latin |
unique |
eindeitige namen |
collapse |
an character string to separate the results ", " |
data |
data.frame oder character |
die selbe Klasse wie der Input
character
character
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)
)
# Beide funktionen machen das gleiche
# nur fix_names ist etwas einfacher gestrickt.
get_label(clean_names(df))
get_label(fix_names(df))
abbreviate2(c("Hallö", "Halü"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.