my data frame look like this:
A S1 S2 S3 S4 1 ex1 1 0 0 0 2 ex2 0 1 0 0 3 ex3 0 0 1 0 4 ex4 1 0 0 0 5 ex5 0 0 0 1 6 ex6
You can use apply and check the max in the columns 2-5 and then return the corresponding column name:
apply
df$Type <- apply(df[2:5], 1, function(x) names(df)[which.max(x)+1] )
Afterwards, you can delete the columns you don't need anymore:
df <- df[,-c(2:5)]