How to merge hhold_train and indiv_train datasets in r

Hi All,

Anyone, please tell me how to merge hhold_train and indiv_train datasets in r.

Regards,
Kishore

You can create new features from indiv_train and add to hhold_train.

As Sagol mentioned, you can create features in hhold_train and merge with indiv_train dataset on ‘id’ column.

@sagol thanks for reply.
then i need to build models for both datasets right, my assumption is correct @sagol, please tell me if i am wrong.

When you add new features from indiv_train to hhold_train dataset you’ll get only one combined dataset for modelling.

@sagol got it now, please have a look below r code and output image,
library(reshape2)
data_w<- dcast(a_indiv_train, id ~ HeUgMnzF,value.var=“iid”)

output:

is this correct way to do, please correct me if i am do any mistake