-2

I would like to do a vlookup a lookup table in R, hence would like to use merge for that.

The data table looks like this:

enter image description here

The mapping table looks like this:

enter image description here

I want to do a vlookup based on the id_type column and type of asset.

My code looks as such:

base1 <- (merge(MappingTable, inputData, by = 'Id_type'))

When I do so, I get this error:

Error in fix.by(by.x, x) : 'by' must specify a uniquely valid column

Need some guidance on this.

smci
  • 29,564
  • 18
  • 109
  • 144
lakshmen
  • 27,102
  • 64
  • 169
  • 262

1 Answers1

0

@lakesh u can do with dplyr package also with full_join :

 library(dplyr)
 base1<-full_join(MappingTable,inputData,by=c("Type Of 
           Asset","Id_type"),all=TRUE)%>%arrange(Idenitifier) ##if u want to ##make order by something use **arrange**
sai saran
  • 677
  • 9
  • 30