Statistics, Science, Random Ramblings

A blog mostly about data and R

listr 0.0.2 is now on CRAN

Posted at — Apr 28, 2022

I am happy to announce that the package listr is now available from CRAN. Since the previous post on version 0.0.1 the listr package has gained three new functions.

For the pattern I found myself constantly applying:

my_list |> 
    list_bind(everything()) |> 

there is now a short-cut:

my_list |>

which will save you some typing and lead to more concise code.

Also new in listr are two functions for checking the type of list elements.

my_list_1 <-  list(
    data.frame(x = 1:5, y = rnorm(5)), 
    data.frame(x = 6:10, y = rnorm(5))
my_list_2 <-  list(
    data.frame(x = 1:5, y = rnorm(5)), 
    tibble::tibble(x = 6:10, y = rnorm(5))

## [1] TRUE
## [1] FALSE
## [1] TRUE

While list_is_same_class() strictly checks whether all elements do have equal classes, list_is_compatible_class() will check for overlaps in the vector returned by class.

The package is now on CRAN, so using it is just one install.packages("listr") away.

What’s next?

After playing a bit with different ways to print lists in R I have for now postponed the plan to introduce a nicer way to do so. It will probably be added at some time in the future, but finding a way to print lists in a concise but useful manner is really hard and for now I would like to focus on adding useful functions to listr. Those are already in development and I hope to add some more polish to the package so I can publish a version 0.1 really soon.