# [R] Re : restructuring matrix

From: justin bem <justin_bem_at_yahoo.fr>
Date: Thu, 28 Jun 2007 07:05:04 +0000 (GMT)

se reshape package

Justin BEM
Elève Ingénieur Statisticien Economiste
BP 294 Yaoundé.
Tél (00237)9597295.

• Message d'origine ---- De : yoooooo <magno_yu_at_ml.com> À : r-help_at_stat.math.ethz.ch Envoyé le : Jeudi, 28 Juin 2007, 2h15mn 52s Objet : Re: [R] restructuring matrix

Yea... let's say I constructed a matrix with rownames/colnames be those unique elements.. then what should I do? I don't want to do mapply, etc to find the field.. I'm wondering if there's a smarter way using row/col.. etc... Thanks!

Moshe Olshansky-2 wrote:

```>
> If your original matrix is A then
> unique(A\$People) and unique(A\$Desc)
> will produce a vector of different people and a vector
> of different descriptions.
>
> --- yoooooo <magno_yu_at_ml.com> wrote:
>
```

>>
>> Hi all,
>>
>> let's say I have matrix
>>
>> People Desc Value
>> Mary Height 50
>> Mary Weight 100
>> Fanny Height 60
>> Fanny Height 200
>>
>> Is there a quick way to form the following matrix?
>>
>> People Height Weight
>> Mary 50 100
>> Fanny 60 200
>>
>> (Assuming I don't know the length of people/desc and
>> let's say these are
>> characters matrix.. I tried play with row(), col(),
>> etc.. but I don't seem
>> to find like a duplicate match function...
>> I'm trying to write some one/two liner that convert
>> my resulting matrix to
>> vector and pick the appropriate fields.. etc )
>>
>> Thanks!
>>
>> --
>> View this message in context:
>>
```> http://www.nabble.com/restructuring-matrix-tf3991741.html#a11334950
```

>> Sent from the R help mailing list archive at
>> Nabble.com.
>>
>> ______________________________________________
>> R-help_at_stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained,
>> reproducible code.
>>
```>
> ______________________________________________
> R-help_at_stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

```
```--
View this message in context: http://www.nabble.com/restructuring-matrix-tf3991741.html#a11335437
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
and provide commented, minimal, self-contained, reproducible code.

_____________________________________________________________________________
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail
[[alternative HTML version deleted]]

______________________________________________
R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help