View source: R/text_remove_backticks.R
text_remove_backticks | R Documentation |
This function removes backticks from a string.
text_remove_backticks(x, ...)
## S3 method for class 'data.frame'
text_remove_backticks(x, column = "Parameter", verbose = FALSE, ...)
x |
A character vector, a data frame or a matrix. If a matrix, backticks are removed from the column and row names, not from values of a character vector. |
... |
Currently not used. |
column |
If |
verbose |
Toggle warnings. |
x
, where all backticks are removed.
If x
is a character vector or data frame, backticks are removed from
the elements of that character vector (or character vectors from the data
frame.) If x
is a matrix, the behaviour slightly differs: in this case,
backticks are removed from the column and row names. The reason for this
behaviour is that this function mainly serves formatting coefficient names.
For vcov()
(a matrix), row and column names equal the coefficient names
and therefore are manipulated then.
# example model
data(iris)
iris$`a m` <- iris$Species
iris$`Sepal Width` <- iris$Sepal.Width
model <- lm(`Sepal Width` ~ Petal.Length + `a m`, data = iris)
# remove backticks from string
names(coef(model))
text_remove_backticks(names(coef(model)))
# remove backticks from character variable in a data frame
# column defaults to "Parameter".
d <- data.frame(
Parameter = names(coef(model)),
Estimate = unname(coef(model))
)
d
text_remove_backticks(d)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.