This is a noob's observation of R, Tidyverse and Stringr. But wow, why can some datasets open in notepad or Windows file preview or excel in 1 second but takes minutes or hours to show up in str_view_all?
One night I got bored and wanted to list out all of the #functions and their #parameters from my #r #package {TidyDensity}
So I got to work with #dplyr #purrr #stringr and some #baser #functions
The steps I took:
✔ use ls() to list all packages from "package:PackageName"
✔ use group_by() to group on the fns column created above
✔ use #purrr #map to get the #methods formalArgs to all fns
✔ drop the c and paste0 fns, (, params and the ending )
Post: https://www.spsanderson.com/steveondata/posts/rtip-2022-12-22/
#methods #Map #baser #stringr #purrr #dplyr #package #r #parameters #functions
The {stringr} #rstats 📦 gets a function to convert a character vector into a single, comma-separated string *with custom wording before the last item.* (I've been using knits::combine_words() for that.)
Example from the tidyverse blog post about stringr 1.5.0:
str_flatten_comma(c("cats", "dogs", "mice"), last = ", and ")
#> [1] "cats, dogs, and mice"
#rstats #oxfordcomma #tidyverse #stringr