r - Reorder data frame values -
i have data frame
(titled emg
), has values (which, example, go u), organized this:
a d g j m p s b e h k n q t c f l o r u
instead, want organized this
a b c d e f g h j k l m n o p q r s t u
i can't use transpose, because transpose whole data frame. there way reorder values horizontally instead of vertically?
thanks
if columns of same type
, can unlist
data frame, create matrix filled row (not default column) , re-coerce data.frame.
eg
as.data.frame(matrix(unlist(emg),nrow=3,byrow=true)) ## v1 v2 v3 v4 v5 v6 v7 ## 1 b c d e f g ## 2 h j k l m n ## 3 o p q r s t u
Comments
Post a Comment