MyNixOS website logo
Description

Preprocessing Tools for Clinical Trial Data.

A collection of functions to preprocess data and organize them in a format amenable to use by chevron.

dunlin: Tools for Clinical Trial Data Wrangling

Check 🛠 Docs 📚 Code Coverage 📔

GitHub forks GitHub repo stars

GitHub commit activity GitHub contributors GitHub last commit GitHub pull requests GitHub repo size GitHub language count Project Status: Active – The project has reached a stable, usable state and is being actively developed. Current Version Open Issues

dunlin provides a variety of data tools to reformat and manipulate a subset of the tables in a data set.

Installation

install.packages("dunlin", repos = c("https://insightsengineering.r-universe.dev", getOption("repos")))

# install.packages("pak")
pak::pak("insightsengineering/dunlin@*release")

Alternatively, you might also use the development version.

install.packages("dunlin", repos = c("https://pharmaverse.r-universe.dev", getOption("repos")))

# install.packages("pak")
pak::pak("insightsengineering/dunlin")

Usage

library(dunlin)

df1 <- data.frame(
  "id" = c("a", "b", NA, "a", "k", "x"),
  "id2" = factor(c("f1", "f2", NA, NA, "f1", "f1")),
  "val" = letters[1:6]
)
df2 <- data.frame(
  "id" = c("a", "b", NA, "a", "k", "x"),
  "id2" = factor(c("f1", "f2", NA, NA, "f1", "f1")),
  "num" = 1:6
)

db <- list(df1 = df1, df2 = df2)

prop_db <- propagate(db, "df1", "val", c("id", "id2"))

which returns prop_db as

 $df1
    id  id2 val
1    a   f1   a
2    b   f2   b
3 <NA> <NA>   c
4    a <NA>   d
5    k   f1   e
6    x   f1   f

$df2
    id  id2 num val
1    a   f1   1   a
2    b   f2   2   b
3 <NA> <NA>   3   c
4    a <NA>   4   d
5    k   f1   5   e
6    x   f1   6   f
new_format <- list(
  df1 = list(
    id = rule("No ID available" = c("", NA, "<Missing>")),
    id2 = rule("<Missing>" = c("", NA, "<Missing>"))
  )
)

res <- dunlin::reformat(prop_db, new_format, .na_last = TRUE)

which result in res as

$df1
               id       id2 val
1               a        f1   a
2               b        f2   b
3 No ID available <Missing>   c
4               a <Missing>   d
5               k        f1   e
6               x        f1   f

$df2
    id  id2 num val
1    a   f1   1   a
2    b   f2   2   b
3 <NA> <NA>   3   c
4    a <NA>   4   d
5    k   f1   5   e
6    x   f1   6   f

Stargazers and Forkers

Stargazers over time

Stargazers over time

Stargazers.

Stargazers repo roster for dunlin

Forkers repo roster for dunlin

Metadata

Version

0.1.7

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows