"attempt to extract more than one element" from an R data.frame-like object : I have an object (here named `rld`) which looks a bit like a data.frame in that it has columns that can be accessed using `$` or `[[]]`.

I have a vector (here named `groups`) containing names of some of its columns (here 3 column names).

I generate strings based on combinations of elements in the columns as follows:

    paste(rld[[groups[1]]], rld[[groups[2]]], rld[[groups[3]]], sep="-")

I would like to generalize this so that I don't need to know how many elements are in `groups`.

The following attempt fails:

    > paste(rld[[groups]], collapse="-")
    Error in normalizeDoubleBracketSubscript(i, x, exact = exact, error.if.nomatch = FALSE) : 
      attempt to extract more than one element


How to do this in an elegant way ?