extract_rectangle: Extract rectangle from omics file, data.table, or matrix

View source: R/3.0_read_omics.R

extract_rectangleR Documentation

Extract rectangle from omics file, data.table, or matrix

Description

Extract rectangle from omics file, data.table, or matrix

Usage

extract_rectangle(x, ...)

## S3 method for class 'character'
extract_rectangle(
  x,
  rows = seq_len(nrows(x, sheet = sheet)),
  cols = seq_len(ncols(x, sheet = sheet)),
  verbose = FALSE,
  transpose = FALSE,
  drop = FALSE,
  sheet = 1,
  ...
)

## S3 method for class 'data.table'
extract_rectangle(
  x,
  rows = seq_len(nrow(x)),
  cols = seq_len(ncol(x)),
  transpose = FALSE,
  drop = FALSE,
  ...
)

## S3 method for class 'matrix'
extract_rectangle(
  x,
  rows = seq_len(nrow(x)),
  cols = seq_len(ncol(x)),
  transpose = FALSE,
  drop = FALSE,
  ...
)

Arguments

x

omics datafile or datatable

...

allow for S3 method dispatch

rows

numeric vector

cols

numeric vector

verbose

logical

transpose

logical

drop

logical

sheet

numeric or string

Value

matrix

Examples

# FROM FILE: extract_rectangle.character
#=======================================
# exprs
   x <- download_data('halama18.metabolon.xlsx')
   extract_rectangle(x, rows = 11:401, cols = 15:86, sheet = 2) %>%
   extract(1:3, 1:3)

# fids
   extract_rectangle(x, rows = 11:401, cols = 5, sheet = 2)     %>%
   extract(1:3, )

# sids
   extract_rectangle(x, rows = 2, cols = 15:86, sheet = 2)      %>%
   extract(,1:3)

# fdt
   extract_rectangle(x, rows = 10:401, cols = 1:14,  sheet = 2) %>%
   extract(1:3, 1:3)

# sdt
   extract_rectangle(x, rows = 1:10,   cols = 14:86, sheet = 2,
   transpose = TRUE) %>% extract(1:3, 1:3)

# FROM MATRIX: extract_rectangle.matrix
#======================================
# exprs
   x <- download_data('halama18.metabolon.xlsx') %>% extract_rectangle(sheet = 2)
   extract_rectangle(x, rows = 11:401, cols = 15:86, sheet = 2) %>%
   extract(1:3, 1:3)

# fids
   extract_rectangle(x, rows = 11:401, cols = 5,     sheet = 2) %>%
   extract(1:3, )

# sids
   extract_rectangle(x, rows = 2,      cols = 15:86, sheet = 2) %>%
   extract(,1:3)

# fdt
   extract_rectangle(x, rows = 10:401, cols = 1:14,  sheet = 2) %>%
   extract(1:3, 1:3)

# sdt
   extract_rectangle(x, rows = 1:10,   cols = 14:86, sheet = 2, transpose = TRUE) %>% 
   extract(1:3, 1:3)

bhagwataditya/importomics documentation built on April 20, 2024, 11:19 p.m.