Learn R Programming

caroline (version 1.1.2)

nv2df: Create a data frame from a named vector

Description

This function simply takes the values of the input vector and assigns it to the first column of the dataframe. The second column assigned from the names of this input vectors).

Usage

nv2df(x, clmn.names=c('x','name'), ...)

Value

a two column dataframe with values of x in the first column and the names of x in the second

Author

David Schruth

Arguments

x

a named vector.

clmn.names

a vector of names of the new columns formed by 1) the values and 2) the names of the named vector.

...

other parameters passed on to data.frame().

See Also

Examples

Run this code

x <- 1:3
nv2df(nv(x,letters[x]), clmn.names=c('x','y'))

Run the code above in your browser using DataLab