datafaker

DataFakeR is an R package designed to help you generate sample of fake data preserving specified assumptions about the original one.

https://github.com/openpharma/datafaker

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
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.9%) to scientific vocabulary

Keywords from Contributors

xlsx shiny
Last synced: 10 months ago · JSON representation

Repository

DataFakeR is an R package designed to help you generate sample of fake data preserving specified assumptions about the original one.

Basic Info
Statistics
  • Stars: 33
  • Watchers: 4
  • Forks: 4
  • Open Issues: 2
  • Releases: 1
Created almost 5 years ago · Last pushed about 3 years ago
Metadata Files
Readme Changelog License

README.Rmd

---
output: github_document
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  eval = TRUE,        
  echo = TRUE,         # echo code?
  message = TRUE,     # Show messages
  warning = TRUE,     # Show warnings
  fig.width = 8,       # Default plot width
  fig.height = 6,      # .... height
  dpi = 200,           # Plot resolution
  fig.align = "center",
  fig.path = "man/figures/README-"
)
knitr::opts_chunk$set()  # Figure alignment   
library(DataFakeR)
set.seed(123)
options(tibble.width = Inf)
```

# DataFakeR 

[![version](https://img.shields.io/static/v1.svg?label=github.com&message=v.0.1.3&color=ff69b4)](https://openpharma.github.io/DataFakeR/)
[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-success.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)

## Overview

DataFakeR is an R package designed to help you generate sample of fake data preserving specified assumptions about the original one. 

## DataFakeR 0.1.3 is now available!
## Installation - from CRAN ``` install.packages("DataFakeR") ``` - latest version from Github ``` remotes::install_github( "openpharma/DataFakeR" ) ``` ## Learning DataFakeR If you are new to DataFakeR, look at the **[Welcome Page](https://openpharma.github.io/DataFakeR/articles/main.html)**. You may find there a list of useful articles that will guide you through the package functionality. ## Usage ### Configure schema YAML structure ``` # schema_books.yml public: tables: books: nrows: 10 columns: book_id: type: char(8) formula: !expr paste0(substr(author, 1, 4), substr(title, 1, 4), substr(bought, 1, 4)) author: type: varchar spec: name title: type: varchar spec: book spec_params: add_second: true genre: type: varchar values: [Fantasy, Adventure, Horror, Romance] bought: type: date range: ['2020-01-02', '2021-06-01'] amount: type: smallint range: [1, 99] na_ratio: 0.2 purchase_id: type: varchar check_constraints: purchase_id_check: column: purchase_id expression: !expr purchase_id == paste0('purchase_', bought) borrowed: nrows: 30 columns: book_id: type: char(8) not_null: true user_id: type: char(10) foreign_keys: book_id_fkey: columns: book_id references: columns: book_id table: books ``` ### Define custom simulation methods if needed ```{r} books <- function(n, add_second = FALSE) { first <- c("Learning", "Amusing", "Hiding", "Symbols", "Hunting", "Smile") second <- c("Of", "On", "With", "From", "In", "Before") third <- c("My", "Your", "The", "Common", "Mysterious", "A") fourth <- c("Future", "South", "Technology", "Forest", "Storm", "Dreams") second_res <- NULL if (add_second) { second_res <- sample(second, n, replace = TRUE) } paste( sample(first, n, replace = TRUE), second_res, sample(third, n, replace = TRUE), sample(fourth, n, replace = TRUE) ) } simul_spec_character_book <- function(n, unique, spec_params, ...) { spec_params$n <- n DataFakeR::unique_sample( do.call(books, spec_params), spec_params = spec_params, unique = unique ) } set_faker_opts( opt_simul_spec_character = opt_simul_spec_character(book = simul_spec_character_book) ) ``` ### Source schema (and check table and column dependencies) ```{r} options("dfkr_verbose" = TRUE) # set `dfkr_verbose` option to see the workflow progress sch <- schema_source("schema_books.yml") ``` ```{r tbls_dep} schema_plot_deps(sch) ``` ```{r books_dep} schema_plot_deps(sch, "books") ``` ### Run data simulation ```{r} sch <- schema_simulate(sch) ``` ### Check the results ```{r} schema_get_table(sch, "books") ``` ```{r} schema_get_table(sch, "borrowed") ``` ## Acknowledgment **The package was created thanks to [Roche](https://www.roche.com/) support and contributions from RWD Insights Engineering Team.** Special thanks to: - [Adam Foryś](mailto:adam.forys@gmail.com) for technical support, numerous suggestions for the current and future implementation of the package. - [Adam Leśniewski](mailto:alesniewski123@gmail.com) for challenging limitations of the package by providing multiple real-world test scenarios (and wonderful hex sticker!). - [Paweł Kawski](mailto:pawel.kawski@gmail.com) for indication of initial assumptions about the package based on real-world medical data. - [Kamil Wais](mailto:kamil.wais@gmail.com) for highlighting the need for the package and its relevance to real-world applications. ## Lifecycle DataFakeR 0.1.3 is at experimental stage. If you find bugs or post an issue on GitHub page at ## Getting help There are two main ways to get help with `DataFakeR` 1. Reach the package author via email: krystian8207@gmail.com. 2. Post an issue on our GitHub page at [https://github.com/openpharma/DataFakeR/issues](https://github.com/openpharma/DataFakeR/issues).

Owner

  • Name: openpharma
  • Login: openpharma
  • Kind: organization

Further precompetitive collaboration in life sciences

GitHub Events

Total
  • Watch event: 2
  • Pull request event: 1
Last Year
  • Watch event: 2
  • Pull request event: 1

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 23
  • Total Committers: 4
  • Avg Commits per committer: 5.75
  • Development Distribution Score (DDS): 0.261
Past Year
  • Commits: 12
  • Committers: 3
  • Avg Commits per committer: 4.0
  • Development Distribution Score (DDS): 0.25
Top Committers
Name Email Commits
Krystian Igras k****s@c****m 17
Krystian Igras k****7@g****m 4
Michael Chirico c****m@g****m 1
Hadley Wickham h****m@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 2
  • Total pull requests: 8
  • Average time to close issues: 9 days
  • Average time to close pull requests: about 2 months
  • Total issue authors: 2
  • Total pull request authors: 3
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.5
  • Merged pull requests: 6
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • RMHogervorst (1)
  • marcinkowskak (1)
Pull Request Authors
  • krystian8207 (4)
  • MichaelChirico (3)
  • hadley (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 260 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
cran.r-project.org: DataFakeR

Generate Fake Data for Relational Databases

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 260 Last month
Rankings
Forks count: 11.3%
Stargazers count: 11.6%
Average: 27.0%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Downloads: 46.6%
Maintainers (1)
Last synced: 11 months ago

Dependencies

DESCRIPTION cran
  • R6 * imports
  • dplyr >= 1.0.0 imports
  • glue * imports
  • magrittr * imports
  • purrr * imports
  • tibble * imports
  • tidygraph * imports
  • yaml * imports
  • DBI * suggests
  • charlatan * suggests
  • covr * suggests
  • httr * suggests
  • knitr * suggests
  • lintr * suggests
  • mockery * suggests
  • rcmdcheck * suggests
  • rmarkdown * suggests
  • stringi * suggests
  • stringr * suggests
  • testthat >= 3.0.0 suggests
.github/workflows/main.yaml actions
  • actions/checkout v2 composite
  • actions/upload-artifact main composite
  • krystian8207/actions/setup-renv master composite
  • r-lib/actions/setup-pandoc v1 composite
  • r-lib/actions/setup-r v1 composite