tRavis is a small R package which contains functions and data that are used regularly in my day-to-day workflows. It also provides an opportunity to practice creating, documenting, and maintaining code, within the framework of an R package and the recommended guidelines.
You can install tRavis from GitHub with:
# install.packages("devtools")
devtools::install_github("travis-m-blimkie/tRavis")
library(tRavis)
#> Thanks for using tRavis v1.5.11! If you encounter any bugs
#> or problems, please submit an issue at the Github page:
#> https://github.com/travis-m-blimkie/tRavis/issues
# Quickly compare two lists:
tr_compare_lists(c(1, 2, 3, 4), c(3, 4, 5, 6), names = c("A", "B"))
#> $unique_A
#> [1] 1 2
#>
#> $common
#> [1] 3 4
#>
#> $unique_B
#> [1] 5 6
# Create a named list of files:
tr_get_files(
directory = system.file("extdata", package = "tRavis"),
pattern = "test",
date = TRUE,
remove_string = "test_"
)
#> $file1
#> [1] "/tmp/RtmprMVMMF/temp_libpathbf115b3f51b/tRavis/extdata/test_file1_20191231.csv"
#>
#> $file2
#> [1] "/tmp/RtmprMVMMF/temp_libpathbf115b3f51b/tRavis/extdata/test_file2_20200101.csv"
# Neatly truncate strings:
tr_trunc_neatly(
x = "This is a long string that we want to break neatly",
l = 40
)
#> [1] "This is a long string that we want to..."
More details and examples can be found at the GitHub Pages website: https://travis-m-blimkie.github.io/tRavis/
Travis Blimkie is the originator and principal contributor. You can check the list of all contributors here.
This project is written under the MIT license, available here.
Thanks to everyone in the lab who has used these functions and provided ideas/feedback!