Skip to contents

Make sample data

Usage

makeSampleData(object, ...)

# S4 method for DFrame
makeSampleData(object)

# S4 method for data.frame
makeSampleData(object)

Arguments

object

Object.

...

Additional arguments.

Value

DataFrame.

Note

Updated 2021-02-25.

Utility function that prepares metadata to be slotted into colData().

This function adheres to the following conventions:

  • Row names are required. Either define manually (recommended) or pass in as a rownames column (data.table / tibble style). Supported colnames: "sampleId", "rowname", "rn".

  • All column names will be converted to lower camel case (see camelCase() for details).

  • sampleName column is always placed first.

Required columns:

  • sampleName: Human readable sample names. Note that this column is useful for plots and doesn't have to match the column names of a SummarizedExperiment object, which should use valid names.

Denylist columns:

  • filename (use fileName).

  • id.

  • interestingGroups. Defined automatically downstream.

  • sample. Too vague. Does this represent an ID or human readable name?

  • samplename (use sampleName).

See also

makeNames.

Examples

## DFrame ====
object <- S4Vectors::DataFrame(
    "genotype" = rep(c("control", "wildtype"), times = 2L),
    "treatment" = rep(c("vector", "RNAi"), each = 2L),
    "sampleName" = paste("sample", seq_len(4L)),
    row.names = paste0("GSM000000", seq_len(4L))
)
makeSampleData(object)
#> DataFrame with 4 rows and 3 columns
#>            sampleName genotype treatment
#>              <factor> <factor>  <factor>
#> GSM0000001   sample 1 control     vector
#> GSM0000002   sample 2 wildtype    vector
#> GSM0000003   sample 3 control     RNAi  
#> GSM0000004   sample 4 wildtype    RNAi