datadictionary

R data dictionary

https://github.com/doctorbjones/datadictionary

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (19.0%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

R data dictionary

Basic Info
  • Host: GitHub
  • Owner: DoctorBJones
  • License: other
  • Language: R
  • Default Branch: main
  • Size: 126 KB
Statistics
  • Stars: 11
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 3
Created about 4 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License

README.Rmd

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

 
 [![CRAN status](https://www.r-pkg.org/badges/version/datadictionary)](https://cran.r-project.org/package=datadictionary)
 [![R-CMD-check](https://github.com/DoctorBJones/datadictionary/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/DoctorBJones/datadictionary/actions/workflows/R-CMD-check.yaml)
 [![Codecov test coverage](https://codecov.io/gh/DoctorBJones/datadictionary/branch/main/graph/badge.svg)](https://app.codecov.io/gh/DoctorBJones/datadictionary?branch=main)
  

# datadictionary

The goal of `datadictionary` is to create a data dictionary from any dataframe or tibble in your R environment. While other packages exist I found they were complicated to use and/or the output wasn't what I was after. This package attempts to solve those problems by presenting tabular summaries of the dataset in a format that fits easily in a pane or screen, using a single line of code. 

It includes an overall summary of the dataset and at-a-glance summaries of each variable. All variables have a count of missing included, and different summaries are provided based on the data class.

For factors, labelled data and logicals the summary will include the name of each level with the level number in parentheses where appropriate. A value for the count of units in each level is included. 

For dates, integers and other numeric types of data the summary includes statistical summaries such as mean, median, mode, minimum and maximum. A value for each is included in the table. 

Character variables include only a count of unique values and missing values. This is the default so if you include a class of data that isn't yet implemented you should get this output.

You can nominate one or more identifier variables, for example individuals and clusters, so you only get a count of unique and missing values rather than nonsense numeric summaries. 

You can also include a vector to add labels if you want descriptions included in the document. Lastly, you can opt for the output to write directly to Excel.


## Installation

You can install the current version of `datadictionary` from CRAN using:

``` r
install.packages("datadictionary")
```

You can install the development version of `datadictionary` from [GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("DoctorBJones/datadictionary")
```

## Example

You can print a basic data dictionary directly to your console or assign it to an object in your environment:

```{r}
library(datadictionary)

create_dictionary(esoph)

esoph_dictionary <- create_dictionary(esoph)
```


You specify one or more identifier variables by passing a quoted string or vector of quoted strings to `id_var`. This is useful if you have hierarchical data, for example and have identifiers for individuals, clusters or blocks.

```{r}

# create fake id variables
mtcars$id1 <- 1:nrow(mtcars)
mtcars$id2 <- mtcars$id1*10

create_dictionary(mtcars, id_var = c("id1", "id2"))

```
You can also optionally add labels for unlabelled variables. You need to pass a named vector  to `var_labels` where the names 
correspond to columns in your dataset. The vector must be of the same length as your dataset.

```{r}

# Create labels as a named vector. 
iris.labels <- c(Sepal.Length = "Sepal length in mm",
                 Sepal.Width = "Sepal width in mm",
                 Petal.Length = "Petal length in mm",
                 Petal.Width = "Petal width in mm",
                 Species = "Species of iris")

create_dictionary(iris, var_labels = iris.labels)
```

You can also write directly to Excel from the `create_dictionary` function if you pass a file path and name as a quoted string to the `file` parameter. There is no visible output for this use.

```{r, eval = FALSE}

create_dictionary(ChickWeight, file = "chickweight_dictionary.xlsx")

```

The package also includes a function to create a summary of a single variable in your dataset. There are no other arguments to this function.
```{r}

summarise_variable(iris, "Sepal.Length")

summarise_variable(ChickWeight, "Diet")
```

Owner

  • Name: Bethany Jones
  • Login: DoctorBJones
  • Kind: user
  • Location: Australia

GitHub Events

Total
  • Create event: 1
  • Issues event: 1
  • Release event: 1
  • Push event: 6
  • Pull request event: 1
Last Year
  • Create event: 1
  • Issues event: 1
  • Release event: 1
  • Push event: 6
  • Pull request event: 1

Packages

  • Total packages: 1
  • Total downloads:
    • cran 290 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 3
  • Total maintainers: 1
cran.r-project.org: datadictionary

Create a Data Dictionary

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 290 Last month
Rankings
Downloads: 24.6%
Dependent packages count: 29.8%
Average: 29.9%
Dependent repos count: 35.5%
Maintainers (1)
Last synced: 10 months ago

Dependencies

DESCRIPTION cran
  • chron * imports
  • data.table * imports
  • dplyr * imports
  • haven * imports
  • labelled * imports
  • lubridate * imports
  • magrittr * imports
  • openxlsx * imports
  • stats * imports
  • tibble * imports
  • tidyr * imports
  • tidyselect * imports
  • testthat >= 3.0.0 suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite