systemdf: Wrapper of system calls in which input and output are all...

Description Usage Arguments Details Value Author(s) Examples

View source: R/systemdf.R

Description

Wrapper of system calls in which input and output are all table-like files

Usage

1
systemdf(cmd, envir = parent.frame(), verbose = FALSE)

Arguments

cmd

shell command

envir

environment where to look for variables encoded in cmd

verbose

whether print messages

Details

This function (system + data frame) provides a convinient way to invoke system calls in R. Since most of system calls expect tables as inputs and outputs, systemdf() does following step by step:

A simple example is as follows:

1
2
3
  bed1 = circlize::generateRandomBed(nr = 1000)
  bed2 = circlize::generateRandomBed(nr = 1000)
  df = systemdf("bedtools closest -a `bed1` -b `bed2` | awk '$1==\"chr1\"'")  

Value

A data frame. Column names may be lost.

Author(s)

Zuguang Gu <z.gu@dkfz.de>

Examples

1
2
3
4
if(Sys.info()["sysname"] %in% c("Linux", "Darwin")) {
    df = data.frame(x = sample(1:10, 10), y = sample(11:20, 10))
    systemdf("sort -k1,1n `df`")
}

jokergoo/epik documentation built on Sept. 28, 2019, 9:20 a.m.