vlookup.df: vloolup.df

Description Usage Arguments Value Examples

View source: R/pub01_utilityFuncs.R

Description

vloolup.df

Usage

1
2
vlookup.df(x, table, by = colnames(x), ret = setdiff(colnames(table), by),
  exclude.x = TRUE)

Arguments

x

a data frame

table

a data frame

by

a vector of character string

ret

a vector of character string or integer

exclude.x

a logical. If the x shoud be inculded in the result?

Value

a data frame (or a vector if exclude.x is TRUE and length of ret is 1).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x <- data.frame(m1=1:3,m2=c("a","b","c"))
table <- data.frame(K1=c(2,3,1,5,6),K2=c("b","c","a","f","x"),v1=LETTERS[1:5],v2=LETTERS[8:12])
vlookup.df(x,table,c("K1","K2"))

y <- data.frame(m1=c(1,3,1),m2=c("a","c","a"))
vlookup.df(y,table,c("K1","K2"))

z <- data.frame(m1=c(1,5,3),m2=c("a","a","c"))
vlookup.df(z,table,c("K1","K2"))
vlookup.df(z,table,c("K1","K2"), exclude.x=FALSE)

raphael210/QUtility documentation built on May 26, 2019, 11:05 p.m.