df_utls: The utility for handling data.frame

df_utlsR Documentation

The utility for handling data.frame

Description

The utility for handling data.frame

Usage

td(dat, nm, rn, fctr_dat)

subd(dat, idlist, idx, mrgn)

subd(dat, idlist, idx, mrgn)

Arguments

dat

data.frame:

nm

character: [default: NULL]

rn

logical: [default: FALSE]

fctr_dat

data.frame or vector

idlist

list: a list for extracting subset

idx

atomic: a column of index for splitting the data.frame

mrgn

integer: margin of data.frame

Examples

## Not run: 

# Create a transposed data.frame with names
td(iris[-5], nm = rownames(iris), rn = T)
td(iris[-5], nm = paste0(substr(iris$Species,1,3), rownames(iris)), rn = T)[1:3,1:3]
td(iris[-5], nm = paste0(substr(iris$Species,1,3), rownames(iris)), rn = F)[1:3,1:3]

# Create a transposed data.frame with names and columns of factor
vdat <- rsko::splt_dat(names(iris[-5]), "\\.", c("organ","where"))
td(iris[-5], nm = rownames(iris), )

dat <- rskodat::fpkm
fctr_dat <- rsko::splt_dat(names(dat), "_", c("cnd","time","rep"))
tdat <- td(dat, rownames(dat), fctr_dat); tdat[1:6]

# Subset with a list for index column
sub_idx1 <- list(toyota = c("Toyota Corolla", "Toyota Corona"),
    mazda = c("Mazda RX4", "Mazda RX4 Wag"))
subd(mtcars, sub_idx1, rownames(mtcars), 1)

sub_idx2 <- list(c("mpg", "disp"), c("vs","gear"))
subd(mtcars, sub_idx2, names(mtcars), 2)


## End(Not run)


shkonishi/rsko documentation built on Feb. 21, 2023, 5:12 a.m.