namedVectorFromColumns: Create Named Vector from two Columns of a Data Frame

View source: R/namedVectorFromColumns.R

namedVectorFromColumnsR Documentation

Create Named Vector from two Columns of a Data Frame

Description

Create Named Vector from two Columns of a Data Frame

Usage

namedVectorFromColumns(data, valueColumn, nameColumn)

Arguments

data

a data frame

valueColumn

name of column in data containing the names

nameColumn

name of column in data containing the values

Value

vector with values in data[[valueColumn]], named by data[[nameColumn]]

Examples

data <- data.frame(a = 1:3, name = LETTERS[1:3])
namedVectorFromColumns(data, valueColumn = "a", nameColumn = "name")

KWB-R/kwb.utils documentation built on April 1, 2024, 7:12 a.m.