NHSRdatasets is a package developed originally by NHS-R Community for use in its free R training and for example code in blogs or other material. It doesn’t contain any sensitive information and, for some datasets, it follows the layout and structure of the data; for others it provides access to freely available data from elsewhere. In these circumstances the data may have been transformed (changed).
These datasets are static and are not updated. As well as being
available through R as a function the data is also
available in the R data format .rda which are available
from the data
folder on GitHub.
Once a dataset is selected the first 10 rows will appear in the console:
or load the package first
To create an object so making the data available as a
data frame:
This package currently provides static datasets for:
Each data set has documentation for the function which can be called by either putting the cursor in the name and selecting F1 or by running the R code:
It’s also possible to write this without the brackets:
If the package hasn’t been loaded it’s still possible to find the
help files by using two question marks to look globally
To see the all the datasets in the package this base R code will open a new window in RStudio with the name of the dataset and the short description
A
search for the code library(NHSRdatasets) on the NHS-R
Community GitHub returns a number of examples, the search criteria
being:
org:nhs-r-community library(NHSRdatasets)