rbind.match: Row Bind Matching Column Names

rbind.matchR Documentation

Row Bind Matching Column Names

Description

row binds a vector to an existing data.frame object (data.frame can be empty). The vector should be named. This function ensures that the vector values are added to the column that shares their respectives names.

Usage

## S3 method for class 'match'
rbind(df.old, x.new, names = colnames(df.old))

Arguments

df.old

data.frame object

x.new

vector object. Should be named carefully

names

Desired column names for output df

Value

data.frame object

Examples

df <- data.frame()
x <- 1:5
names(x) <- c("a","b","c","f","g")
rbind.match(df, x, names = c("a","b","c","d","e")) 
rbind.match(df, x, names = c("g","f","c","b","a")) 


dennisteowh/dthelper documentation built on March 19, 2022, 11:42 a.m.