The goal of foofactors is to separate a string, but to prevent R from making it a list.
You can install the development version of foofactors from GitHub with:
# install.packages("devtools")
devtools::install_github("LaurineSeelt/foofactors")
This is a basic example which shows you how to solve a common problem:
# install.packages("devtools")
devtools::install_github("LaurineSeelt/foofactors")
#> Skipping install of 'foofactors' from a github remote, the SHA1 (6b2902e7) has not changed since last install.
#> Use `force = TRUE` to force installation
library(foofactors)
(x <- "alfa,bravo,charlie,delta")
#> [1] "alfa,bravo,charlie,delta"
str_split_one(x, pattern = ",")
#> [1] "alfa" "bravo" "charlie" "delta"
This works better than the example below.
(x <- "alfa,bravo,charlie,delta")
#> [1] "alfa,bravo,charlie,delta"
strsplit(x, split = ",")
#> [[1]]
#> [1] "alfa" "bravo" "charlie" "delta"
stringr::str_split(x, pattern = ",")
#> [[1]]
#> [1] "alfa" "bravo" "charlie" "delta"
This returns a list of 1. Thus output is often inconvenient, so the foofactors function solves this.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.