Learn R Programming

strvalidator (version 0.3.0)

colNames: colNames

Description

colNames is an internal helper function.

Usage

colNames(df, slim = TRUE, concatenate = NULL)

Arguments

df
data.frame.
slim
logical, TRUE returns column names occuring once, FALSE returns column names occuring multiple times.
concatenate
string, if not NULL returns a single string with column names concatenated by the provided string instead of a vector.

Value

  • character, vector or single string.

Details

colNames takes a data frame as input and return either column names occuring once or multiple times. Matching is done by the 'base name' (the substring to the left of the first period, if any). The return type is a string vector by default, or a single string of colum names separated by a string 'concatenate' (see 'collapse' in paste for details).