Closed lwaldron closed 6 years ago
I think what I expected would be usually more useful, but I would welcome any other thoughts on expected behavior, @LiNk-NY @vjcitn @kasperdanielhansen @mtmorgan @seandavi @ttriche @lawremi @PeteHaitch? Actually the dimensions I expected above would require leaving the variable name of one duplicate unchanged, and appending the column name to the others. This selection of one duplicate over the others might be arbitrary.
Hi Levi, @lwaldron
I see what you mean.
This can be done by selectively reshaping duplicated rows to include the "colname" in the resulting columns (which may get a bit complicated) and then reshaping the rest of the columns via the simple method. Finally, we can do a cbind
to join the duplicated and non-duplicated data.frame
s.
For example, we can take rows c(1,2)
and reshape those differently than c(3:5)
:
longDataFrame
assay primary rowname colname value
1 Methyl450k Jack ENST00000355076 methyl1 1
2 Methyl450k Jack ENST00000355076 methyl2 6
3 Methyl450k Jill ENST00000355076 methyl3 11
4 Methyl450k Barbara ENST00000355076 methyl4 16
5 Methyl450k Bob ENST00000355076 methyl5 21
Regards, Marcel
As a side note, I've improved the output of the duplicated
method on a MultiAssayExperiment
. See 60f9bcb87df9ec190c436e90691f5997050428cf
For example:
Or in other words, I had expected to see the column name appended only to duplicated columns by
wideFormat()
, not to all columns.