I have data frame Df with five columns and fifth column(TypeWire) is concatenate of first two columns to make things simpler. For every Type(like A) there should be 'Land' and 'WiFi' but in my dataframe it is missing for some of the Type's(For ex=WiFi for D and B is missing). Now how can i add row if any of the Wire missing for Type? to make things simple as stated above column TypeWire has been added. I can manually add that to dataframe but i m looking for way that it can detect automatically and add the row(for ex= B WiFI 0 0 BWiFi) I tried to create below function just for type B and D (if thbut it is adding the entry if even it exist in TypeWire column like BLand is there in TypeWire but still row for that hasbeen created by below funtion.
Missadd2<-function(x){
if(any(!(x$TypeWire == 'DWiFi'))){
x <- rbind(x, newrow<-c("D","WiFi",0,0,"DWiFi"))
}else if(any(!(x$TypeWire == 'BWiFi'))){
x <- rbind(x, newrow<-c("B","WiFi",0,0,"BWiFi"))
}else if(any(!(x$TypeWire == 'BLand'))){
x <- rbind(x, newrow<-c("B","Land",0,0,"BLand"))
}
}