dspk.vectorize: Vectorize utility function

Description Usage Arguments Details Value Examples

View source: R/SpikeRemovalFunctions.R

Description

This function is not exported

Usage

1
dspk.vectorize(Value, Data = NULL, na.strings = NULL, sup.warn = FALSE)

Arguments

Value

Either the vector itself, the column name as a string in quotes or the column number as numeric

Data

An R object dataframe. Optional.

na.strings

allows you to handle NA values. ex: na.strings = c(-777, NA) all values of -777 will be replaced with values of NA

sup.warn

if TRUE it will prevent warning messages

Details

Vector data can be processed much faster than data in a dataframe. Can take a vector directly, a data frame and a column name or a data frame and a column number.

Value

A vector object of the input

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#Data is vectorized either from vector itself, or a datatable and you can put in either the name of the column or the column number
#    ex: a <- c(1,2,3,4)
#        b <- c('a','b','c','d')
#        c <- data.frame(a,b)
#
#        dspk.vectorize(b)  #selecting the vector directly
#        > [1] 'a' 'b' 'c' 'd'
#        dspk.vectorize(Data = c, Value = 'b')  #selecting the column from a dataframe using column name
#        > [1] 'a' 'b' 'c' 'd'
#        dspk.vectorize(Data = c, Value = 2)  #selecting the column from a dataframe using column number
#        > [1] 'a' 'b' 'c' 'd'
#        WARNING: If you are trying to select a column from a dataframe but you don't places Value in quotes,
#                 and your entred value is an already existing variable, then it will vectorize that variable
#                 and ignor the given dataframe. See example below.
#        dspk.vectorize(Data = c, Value = b)  #selecting the column from a dataframe using column name
#        > [1] 'a' 'b' 'c' 'd'

pgelsomini/HICbioclean documentation built on Dec. 28, 2021, 5:22 p.m.