Skip to contents

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")
#> A B C 
#> 1 2 3