colnames {slinky} | R Documentation

## colnames

### Description

Retrieve column names from LINCS gctx datafile

### Usage

    colnames(x, do.NULL = TRUE, prefix = "col")

    ## S4 method for signature 'Slinky'
    colnames(x)

### Arguments

`x` | a Slinky Object
`do.NULL` | Ignored (see `?base::colnames`)
`prefix` | Ignored (see `?base::colnames`)

### Value

Names of columns from gctx file The gctx file is an HDF5 formatted file with several sections (groups) containing the column and row level metadata as well as the expression data itself. Note that for best performance, if a subset of colnames is desired, subset the slinky object itself, not the colnames, to avoid loading the entire set of colnames from the the gctx file. That is, `names <- colnames(x[,1:50])` will be considerably faster than `names <- colnames(x)[1:50]`. The `do.NULL` and `prefix` arguments from `base::colnames` do not apply here (as the slinky object will always have column names), and will be silently ignored if provided.

### Examples

    # for build/demo only.  You MUST use your own key when using the slinky
    # package.
    user_key <- httr::content(httr::GET('https://api.clue.io/temp_api_key'),
                              as='parsed')$user_key
    sl <- Slinky(user_key,
                     system.file('extdata', 'demo.gctx',
                          package='slinky'),
                     system.file('extdata', 'demo_inst_info.txt',
                         package = 'slinky'))
    colnames(sl[,1:5])

[Package slinky version 1.10.0 Index]