Skip to contents

[Stable]

Usage

# S3 method for MultiAssayExperiment
dataset(
  dataname,
  x,
  keys = character(0),
  label = data_label(x),
  code = character(0),
  vars = list(),
  metadata = NULL
)

dataset(
  dataname,
  x,
  keys = character(0),
  label = data_label(x),
  code = character(0),
  vars = list(),
  metadata = NULL
)

# S3 method for data.frame
dataset(
  dataname,
  x,
  keys = character(0),
  label = data_label(x),
  code = character(0),
  vars = list(),
  metadata = NULL
)

Arguments

dataname

(character) a given name for the dataset, it cannot contain spaces

x

(data.frame or MultiAssayExperiment) object from which the dataset will be created

keys

optional, (character) vector with primary keys

label

(character) label to describe the dataset

code

(character) a character string defining the code needed to produce the data set in x

vars

(named list) in case when this object code depends on other TealDataset object(s) or other constant value, this/these object(s) should be included as named element(s) of the list. For example if this object code needs ADSL object we should specify vars = list(ADSL = <adsl object>). It's recommended to include TealDataset or TealDatasetConnector objects to the vars list to preserve reproducibility. Please note that vars are included to this object as local vars and they cannot be modified within another dataset.

metadata

(named list or NULL) field containing metadata about the dataset. Each element of the list should be atomic and length one.

Value

TealDataset object

Examples

# Simple example
utils::data(miniACC, package = "MultiAssayExperiment")
mae_d <- dataset(
  "MAE",
  miniACC,
  keys = c("STUDYID", "USUBJID"),
  metadata = list(type = "example")
)
#> Loading required package: MultiAssayExperiment
#> Loading required package: SummarizedExperiment
#> Loading required package: MatrixGenerics
#> Loading required package: matrixStats
#> 
#> Attaching package: ‘MatrixGenerics’
#> The following objects are masked from ‘package:matrixStats’:
#> 
#>     colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
#>     colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
#>     colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
#>     colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
#>     colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
#>     colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
#>     colWeightedMeans, colWeightedMedians, colWeightedSds,
#>     colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
#>     rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
#>     rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
#>     rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
#>     rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
#>     rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
#>     rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
#>     rowWeightedSds, rowWeightedVars
#> Loading required package: GenomicRanges
#> Loading required package: stats4
#> Loading required package: BiocGenerics
#> 
#> Attaching package: ‘BiocGenerics’
#> The following objects are masked from ‘package:stats’:
#> 
#>     IQR, mad, sd, var, xtabs
#> The following objects are masked from ‘package:base’:
#> 
#>     Filter, Find, Map, Position, Reduce, anyDuplicated, append,
#>     as.data.frame, basename, cbind, colnames, dirname, do.call,
#>     duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
#>     lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
#>     pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
#>     tapply, union, unique, unsplit, which.max, which.min
#> Loading required package: S4Vectors
#> 
#> Attaching package: ‘S4Vectors’
#> The following objects are masked from ‘package:base’:
#> 
#>     I, expand.grid, unname
#> Loading required package: IRanges
#> Loading required package: GenomeInfoDb
#> Loading required package: Biobase
#> Welcome to Bioconductor
#> 
#>     Vignettes contain introductory material; view with
#>     'browseVignettes()'. To cite Bioconductor, see
#>     'citation("Biobase")', and for packages 'citation("pkgname")'.
#> 
#> Attaching package: ‘Biobase’
#> The following object is masked from ‘package:MatrixGenerics’:
#> 
#>     rowMedians
#> The following objects are masked from ‘package:matrixStats’:
#> 
#>     anyMissing, rowMedians
#> 
#> Attaching package: ‘MultiAssayExperiment’
#> The following object is masked _by_ ‘.GlobalEnv’:
#> 
#>     miniACC
mae_d$get_dataname()
#> [1] "MAE"
mae_d$get_dataset_label()
#> character(0)
mae_d$get_metadata()
#> $type
#> [1] "example"
#> 
mae_d$get_code()
#> [1] ""
mae_d$get_raw_data()
#> A MultiAssayExperiment object of 5 listed
#>  experiments with user-defined names and respective classes.
#>  Containing an ExperimentList class object of length 5:
#>  [1] RNASeq2GeneNorm: SummarizedExperiment with 198 rows and 79 columns
#>  [2] gistict: SummarizedExperiment with 198 rows and 90 columns
#>  [3] RPPAArray: SummarizedExperiment with 33 rows and 46 columns
#>  [4] Mutations: matrix with 97 rows and 90 columns
#>  [5] miRNASeqGene: SummarizedExperiment with 471 rows and 80 columns
#> Functionality:
#>  experiments() - obtain the ExperimentList instance
#>  colData() - the primary/phenotype DataFrame
#>  sampleMap() - the sample coordination DataFrame
#>  `$`, `[`, `[[` - extract colData columns, subset, or experiment
#>  *Format() - convert into a long or wide DataFrame
#>  assays() - convert ExperimentList to a SimpleList of matrices
#>  exportClass() - save data to flat files
# Simple example
dataset("iris", iris)
#> A TealDataset object containing the following data.frame (150 rows and 5 columns):
#>   Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#> 1          5.1         3.5          1.4         0.2  setosa
#> 2          4.9         3.0          1.4         0.2  setosa
#> 3          4.7         3.2          1.3         0.2  setosa
#> 4          4.6         3.1          1.5         0.2  setosa
#> 5          5.0         3.6          1.4         0.2  setosa
#> 6          5.4         3.9          1.7         0.4  setosa
#> 
#> ...
#>     Sepal.Length Sepal.Width Petal.Length Petal.Width   Species
#> 145          6.7         3.3          5.7         2.5 virginica
#> 146          6.7         3.0          5.2         2.3 virginica
#> 147          6.3         2.5          5.0         1.9 virginica
#> 148          6.5         3.0          5.2         2.0 virginica
#> 149          6.2         3.4          5.4         2.3 virginica
#> 150          5.9         3.0          5.1         1.8 virginica

# Example with more arguments
library(scda)
ADSL <- synthetic_cdisc_data("latest")$adsl
ADSL_dataset <- dataset(dataname = "ADSL", x = ADSL)

ADSL_dataset$get_dataname()
#> [1] "ADSL"

ADSL_dataset <- dataset(
  dataname = "ADSL",
  x = ADSL,
  label = "AdAM subject-level dataset",
  code = "ADSL <- synthetic_cdisc_data(\"latest\")$adsl",
  metadata = list(type = "synthetic data")
)
ADSL_dataset$get_metadata()
#> $type
#> [1] "synthetic data"
#> 
ADSL_dataset$get_dataset_label()
#> [1] "AdAM subject-level dataset"
ADSL_dataset$get_code()
#> [1] "ADSL <- synthetic_cdisc_data(\"latest\")$adsl"