[R] Adding two different factors to one observation?

Florian Ahrweiler florian.ahrweiler at uni-wh.de
Fri Nov 23 18:25:05 CET 2012


On 16.11.2012 01:19, arun wrote:
>
>
> Hi,
>
> If you want to convert from the first way to the second way suggested by Jean:
[...]

>
>
> A.K.
>
>
>
> ----- Original Message -----
> From: Jean V Adams <jvadams at usgs.gov>
> To: Florian Ahrweiler <florian.ahrweiler at uni-wh.de>
> Cc: r-help at r-project.org
> Sent: Thursday, November 15, 2012 2:50 PM
> Subject: Re: [R] Adding two different factors to one observation?
>
> Florian,
>
> There are a number of different ways to handle data like this.  Two that
> come to my mind are shown below.  You could allow each observation to be
> represented by multiple rows in the data frame:
[...]

> Or you could let each level be its own variable:
>
>    obs cup plate saucer
> 1   1   0     0      1
> 2   2   1     1      1
> 3   3   1     1      0
> 4   4   1     0      1
> 5   5   0     0      0
> 6   6   0     1      1
> 7   7   0     1      0
> 8   8   1     0      0
>
> The arrangement that you choose will likely depend on what you want to do
> with the data.
>
> Jean
>
Dear Jean,
dear arun

Thank you very much for your help. I could develop a strategy for my 
taks from it. I'll do it like this: I concentrate the 30+ categories I 
have and convert them into three variables; then I take the second 
solution with

	saucer	plate	cup
1	0	1	1
2	1	0	0
3	0	1	0
4	1	0	1

and so on.

Again, thanks a lot!

Florian

Arzt
Doktorand

Integriertes Begleitstudium für anthroposophisch erweiterte Medizin
Zentrum für Integrative Medizin
Department für Humanmedizin
Fakultät für Gesundheit
Universität Witten/Herdecke

physician
dissertation student

Integrated Curriculum for Anthroposophic Medicine
Centre for Integrative Medicine
School of Medicine
Faculty of Health
Witten/Herdecke University




More information about the R-help mailing list