findColumn.byname {datana}R Documentation

A function that finds the position of a specific variable.

Description

This function finds the column-position of a specified column-name in an object (either a data frame or vector).

Usage

findColumn.byname(data = data, col.name = col.name)

Arguments

data

a dataframe containing variables as columns

col.name

is a string specifying the name of the variable

Value

The number representing the column position in the dataframe of the requested column-name. It can also be used for several names, thus, will return a vector of numbers.

Note

It can be used for a vector of specified column-names as well.

Author(s)

Christian Salas-Eljatib

Examples

data(deadForestCA)
df <- deadForestCA
names(df)
findColumn.byname(df, "Defz2")
findColumn.byname(df, c("Defnorm","mort.bin"))
  

[Package datana version 1.0.3 Index]