DiscoverR-bloggersMetacore and Metatools 0.2.0
Metacore and Metatools 0.2.0

Metacore and Metatools 0.2.0

Update: 2025-08-04
Share

Description




[This article was first published on pharmaverse blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.










<bslib-tooltip placement="auto" bsoptions="[]" data-require-bs-version="5" data-require-bs-caller="tooltip()"></bslib-tooltip>


<template>A Centralized Metadata Object Focus on Clinical Trial Data Programming Workflows • metacore</template> {metacore} and <bslib-tooltip placement="auto" bsoptions="[]" data-require-bs-version="5" data-require-bs-caller="tooltip()"> <template>GitHub – pharmaverse/metatools</template> {metatools} </bslib-tooltip> have a new package maintainer


Hi, everyone! I’m Liam and I’m excited to announce that I have taken over as package maintainer for both <bslib-tooltip placement="auto" bsoptions="[]" data-require-bs-version="5" data-require-bs-caller="tooltip()"> <template>A Centralized Metadata Object Focus on Clinical Trial Data Programming Workflows • metacore</template> {metacore} </bslib-tooltip> and <bslib-tooltip placement="auto" bsoptions="[]" data-require-bs-version="5" data-require-bs-caller="tooltip()"> <template>GitHub – pharmaverse/metatools</template> {metatools} </bslib-tooltip> from Christina Fillmore. I work at GSK as a clinical programmer and I am coming to the end of my second year in the industry. This is my first experience working within the open-source world, but I am a regular user of pharmaverse packages and am keen to get more involved with the community.


Christina remains on-hand as a mentor and I’d like to thank both her and Ben Straub for the continued support before we dive into the details of <bslib-tooltip placement="auto" bsoptions="[]" data-require-bs-version="5" data-require-bs-caller="tooltip()"> <template>A Centralized Metadata Object Focus on Clinical Trial Data Programming Workflows • metacore</template> {metacore} </bslib-tooltip>/<bslib-tooltip placement="auto" bsoptions="[]" data-require-bs-version="5" data-require-bs-caller="tooltip()"> <template>GitHub – pharmaverse/metatools</template> {metatools} </bslib-tooltip> 0.2.0.




What’s new in metacore?


The goal of version 0.2.0 was to clarify the distinction between an imported Metacore spec, containing information about multiple datasets, and a subsetted spec containing information about just a single dataset (as achieved via <bslib-tooltip placement="auto" bsoptions="[]" data-require-bs-version="5" data-require-bs-caller="tooltip()"> <template>Select metacore object to single dataset — select_dataset • metacore</template> metacore::select_dataset() </bslib-tooltip>).


We received a number of questions and issues raised where users were attempting to use a Metacore object containing metadata for multiple datasets in functions from <bslib-tooltip placement="auto" bsoptions="[]" data-require-bs-version="5" data-require-bs-caller="tooltip()"> <template>GitHub – pharmaverse/metatools</template> {metatools} </bslib-tooltip> that were designed to take a single, subsetted specification. When developing datasets, the typical workflow is to be working on a single dataset at a time – so subsetting the Metacore object is the logical thing to do. The issue was that the approach to functions in <bslib-tooltip placement="auto" bsoptions="[]" data-require-bs-version="5" data-require-bs-caller="tooltip()"> <template>GitHub – pharmaverse/metatools</template> {metatools} </bslib-tooltip> was inconsistent, with some functions permitting multiple specification metadata and others not.


Now, a Metacore object which has multiple datasets or one with a single dataset have been redesigned to be programmatically distinct, with the single dataset implemented as a subclass of Metacore called “DatasetMeta”.


From the users’ perspective there is one key change. A metadata object about a single dataset will be required for users to work with <bslib-tooltip placement="auto" bsoptions="[]" data-require-bs-version="5" data-require-bs-caller="tooltip()"> <template>GitHub – pharmaverse/metatools</template> {metatools} </bslib-tooltip> functions, which have had their API harmonised to accept only subsetted Metacore objects (via <bslib-tooltip placement="auto" bsoptions="[]" data-require-bs-version="5" data-require-bs-caller="tooltip()"> <template>Select metacore object to single dataset — select_dataset • metacore</template> metacore::select_dataset() </bslib-tooltip>).


The print statements of both combined and subsetted Metacore objects have been refined to better illustrate the differences between them and provide more helpful information to the user.



library(dplyr)



Attaching package: 'dplyr'



The following objects are masked from 'package:stats':

filter, lag



The following objects are masked from 'package:base':

intersect, setdiff, setequal, union


library(metacore)
library(metatools)
library(tibble)
library(haven)

load(metacore_example("pilot_ADaM.rda"))
metacore


── Metacore object contains metadata for 5 datasets ────────────────────────────



→ ADSL (Subject-Level Analysis Dataset)



→ ADADAS (ADAS-Cog Analysis)



→ ADLBC (Analysis Dataset Lab Blood Chemistry)



→ ADTTE (AE Time To 1st Derm. Event Analysis)



→ ADAE (Adverse Events Analysis Dataset)






ℹ To use the Metacore object with metatools package, first subset a dataset using `metacore::select_dataset()`



The <bslib-tooltip placement="auto" bsoptions="[]" data-require-bs-version="5" data-require-bs-caller="tooltip()"> <template>Select metacore object to single dataset — select_dataset • metacore</template> metacore::select_dataset() </bslib-tooltip> function is now explicit about what is being selected:



adsl_spec <- select_dataset(metacore, "ADSL", quiet = TRUE)


✔ ADSL dataset successfully selected



ℹ Dataset metadata specification subsetted with suppressed warnings



Printing the subsetted object now provides more detailed information:



adsl_spec


── Dataset specification object for ADSL (Subject-Level Analysis Dataset) ──────



The dataset contains 51 variables



Dataset key: USUBJID






The structure of the specification object is:



→ codelist: character [16 x 4] code_id, name, type, codes



→ derivations: character [50 x 2] deriva
Comments 
00:00
00:00
x

0.5x

0.8x

1.0x

1.25x

1.5x

2.0x

3.0x

Sleep Timer

Off

End of Episode

5 Minutes

10 Minutes

15 Minutes

30 Minutes

45 Minutes

60 Minutes

120 Minutes

Metacore and Metatools 0.2.0

Metacore and Metatools 0.2.0

Liam Hobby