col_selector: select columns based on vectors

Description Usage Arguments Value Note Author(s) Examples

View source: R/col_selector_v1.R

Description

function for precise selecting/ reordering columns with similar names within a data frame. It is suggested to use it after the function col_agrecounter() to select only columns of interest

Usage

1
col_selector(inputDF, key_words)

Arguments

inputDF

data frame with headings and at least two columns

key_words

vector of characters to reorganize columns. Use special characters to extract key_words: *=any character; ^=block beginning of the string , $=block end of the string

Value

returns data freme with columns defined in key_words argument

Note

use Regular Expression Syntax to precisely select columns

Author(s)

Zofia Wicik

Examples

1
2
3
4
5
6
#example###
inputDF<-iris
names(inputDF)
key_words<-c("Species", "*Width", "*Length")
temp<-col_selector(inputDF,key_words)
names(temp) #width and lenght is now grouped together

wizbionet/wizbionet documentation built on Sept. 9, 2020, 12:45 a.m.