my code:
orders column one of new data frame by column two of previous data frame
matchOrder<- function(x,y){
y[match(x[,2], y[,1]),];
}
orders column one of new data frame by column one of previous data frame
matchOrder1<- function(x,y){
y[match(x[,1], y[,1]),];
}
creates the individual data frames as we want them and bind them
onea<- one[order(one[,2]),];
twoa<- matchOrder(onea,two);
threea<- matchOrder(twoa,three);
foura<- matchOrder(threea,four);
##error
fivea<- matchOrder1(foura,five);
##error
finaltable<- cbind(onea, twoa, threea, foura, fivea);
finaltable;
What I want to do is when foura throws an error, I want to make a function that will paste and cbind in everything before foura (or any error), this way I dont have to always modify the code before running it.
output:
finaltable<- cbind(onea, twoa, threea);