add_vector_to_df: Add vector to a (n x 2) data frame

Description Usage Arguments Value Examples

View source: R/operations.R

Description

Given a vector, adds each value and its corresponding name to a data frame of 2 columns as new rows, where the name fills in the 1st column and the value the 2nd column.

Usage

1

Arguments

df

data.frame, with n rows and 2 columns

vec

a vector

Value

a data.frame with additional rows and each element as a character.

Examples

1
2
3
4
5
df = data.frame(c(0,0,1), c(0,0,2))
vec = 1:3
names(vec) = c("a","b","c")

add_vector_to_df(df, vec)

bblodfon/usefun documentation built on Nov. 13, 2019, 12:43 p.m.