[R] Reshape

stephen sefick ssefick at gmail.com
Tue Mar 3 15:06:22 CET 2009


check out the melt function in the reshape package.

On Tue, Mar 3, 2009 at 8:53 AM, Usuario R <r.user.spain at gmail.com> wrote:
> Hi all,
>
> I would like to transform to long format a matrix  which has only
> information about individuals and a value for each individual. I would like
> to have it in ling format with more information related to groups, so ell
> values and individuals are repeated for each group. Let me show the example:
>
> matrix in wide format:
>
> Individuals    Value
> A    3
> B    4
> C    5
> D    2
>
> And long format would be like:
>
> Individuals    Value    Group
> A    3    Group1
> B    4    Group1
> C    5    Group1
> D    2    Group1
> A    3    Group2
> B    4    Group2
> C    5    Group2
> D    2    Group2
>
> My case is of course very large so i thought this could be possible with
> reshape function by adding a vector with the names of the groups or
> something like that.
>
> Thanks in advance.
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

								-K. Mullis




More information about the R-help mailing list