I have a data frame like this in R
df <- data.frame(V1=c("L", "L", "P", "P"), V2=c("M", "M", "M" , "M"), V3=c("X", "X", "X", "X" ), V4=c( "V","V","V","V"))
I would like to subset this data frame based on the mismatches found by row and create two different tables like this
df1
V1 V2 V3 V4
1 L M X V
2 L M X V
df2
V1 V2 V3 V4
1 P M X V
2 P M X V
I know that can be done by split(df, df$V1) but I would like to know if there is a more "automatic" way in which I do not have to specify the col with mismatches
Thank you!