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
Could also do (if dat is your data set)
dat
library(reshape2) dat <- melt(dat, id = "A") dat[dat$value > 0, 1:2]