Automatically generate names for vectors
autonames(x, ..., trimws = TRUE)
A vector
Additional arguments passed to format()
Whether to trim whitespace surrounding automatically formatted
names.
Defaults to TRUE
.
Returns the names of a named vector and the elements of an unnamed vector formatted as characters.
autonames(c(a = "apple", b = "banana", c = "cantaloupe"))
#> [1] "a" "b" "c"
autonames(c("apple", "banana", "cantaloupe"))
#> [1] "apple" "banana" "cantaloupe"
autonames(10^(1:4))
#> [1] "10" "100" "1000" "10000"
autonames(10^(1:4), big.mark = ",")
#> [1] "10" "100" "1,000" "10,000"
autonames(10^(1:4), scientific = TRUE)
#> [1] "1e+01" "1e+02" "1e+03" "1e+04"