combine_words_ptbr()
collapse words using ptbr rules. This function
differ from knitr::combine_words()
which uses oxford commas.
combine_words_ptbr(words, sep = NULL, last = NULL)
a character vector with words to combine
a character with the separator of the words. Default is NULL and insert ", "
a character vector with the last separator of the words. Default is NULL and insert " e "
a character vector
combine_words_ptbr()
uses transformers
available in the excellent {glue}
package
if (FALSE) {
misc::ipak(c("dplyr", "broom", "glue"))
# showing significant variables
mtcars %>%
select(mpg, cyl, carb, wt) %>%
lm(mpg ~ cyl + carb + wt, data = .) %>%
tidy() %>%
filter(p.value <= 0.05, term != "(Intercept)") %>%
pull(term) %>%
{
paste("Variáveis significativas:", combine_words_ptbr(.))
}
# using in an ordinary text
feira <- c("banana", "maça", "pepino", "ovos")
glue("Por favor, compre: {combine_words_ptbr(feira)}")
}