Introduction to libr
R is a very flexible and powerful language. But there are some inconveniences when working with data:
Loading many related datasets: When you have many data files that are related in some way, it is troublesome when you want to use them all in your analysis. Most data import packages make you load each file individually. And the thing is, almost all data comes in sets of related files. So you would think that there would be an easy mechanism to load them all at once.
Examining the Attributes of Your Data: Once you have a set of related data files loaded into your program, the next problem is how to examine the structure of all of them. R has the
str()function if you want to understand the structure of a single dataset. But what if there are many? There is no simple way to examine the attributes of many related datasets. And further, some valuable attributes are missing from the
Row-By-Row Processing of Data: R processes data column by column. In most cases, column-by-column is a perfectly suitable way of processing data. But in some cases it is desirable to process data row-by-row. Row-by-row processing is useful when you have many related columns, and want to perform complex conditional processing across them. It is also very convenient when you have grouped data, and want to perform conditional processing within a group.
The libr package was developed to address all of the above problems. It does so by introducing three concepts:
- Data Libraries
- Data Dictionaries
- A Data Step
By introducing these concepts, the libr package makes working with data in R much easier and faster. The libr package can greatly simplify your data processing code. And it makes some types of data operations effortless that are quite tricky to do with Base R or even tidyverse functions.
To install the libr package, run the following command from your R console:
Then put the following line at the top of your program or script:
The libr package will then be ready to use! For examples and usage information, please visit the libr documentation site here
If you need help, the first place to turn to is the libr web site. The web site has full documentation on all libr functions.
If you want to look at the code for the libr package, visit the github page here.
If you encounter a bug or have a feature request, please submit an issue here.
The libr package is part of the sassy meta-package. The sassy meta-package includes several packages that help make R easier for everyone, especially people with a background in SAS® software. You can read more about the sassy package here.