[R] Odp: Fwd: data format

Petr PIKAL petr.pikal at precheza.cz
Wed Oct 31 08:19:57 CET 2007


Hi

r-help-bounces at r-project.org napsal dne 30.10.2007 21:49:37:

> Excuse me for less detailed e-mail I've sent before, I guess there's a
> misunderstanding here.

And still is. You even did not show us how are your data stored in R.

> My problem is to use the data in the order I've typed below without
> splitting it. Is it possible? I really don't know. Some statistics 
packages
> do it.
> 
> Original Data is;
> 
> Good,Bad
> 10,12
> 15,15
> 18,10
> 12
> 
> 
> 
> But I have the data in the following form,
> Label,Value
> Good,10
> Bad,12
> Good,15
> Good,18
> Good,12
> Bad,15
> Bad,10

If you have data frame "test" like this you can do:

selection<-test$Label=="Good"
ks.test(test[selection,2], test[!selection,2])

or

test.s<-split(test$Value, test$Label)
ks.test(test.s[[1]], test.s[[2]])

If you prefer you can use selection or split inside *.test functions, 
however it seems to me that separated version is more readable.

I also wander why you so much resist to split data into list? It is quite 
natural way how to handle them and R is pretty good in work with lists 
with its *apply functions.

Regards
Petr

> 
> 
> And I want to analyze the data without splitting it. I guessed whether
> there's a quick/simple solution to my problem. Array functions do solve 
this
> problem in general.  Now I'm reading the help files about "How to deal 
with
> arrays in R environment?".
> 
> Thx a lot for your concern
> Emre
> 
> 
> 
> 
> 
> ---------- Forwarded message ----------
> From: Emre Unal <emre.unal at gmail.com>
> Date: Oct 30, 2007 4:39 PM
> Subject: data format
> To: r-help at r-project.org
> 
> Hi,
> 
> How can I analyze the data collected in database formatting (with 
labels)
> rather than splitted by individual columns (almost in excel)?
> 
> For example (comma separated data);
> 
> Label,Value
> Good,10
> Bad,12
> Good,15
> Good,18
> Good,12
> Bad,15
> Bad,10
> etc...
> 
> ks.test or chisq.test can be done.
> Splitting the data into new columns is not applicable cos' I'll use
> R-integration in another software.
> 
> 
> 
> Thanks for your concern
> Emre
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> ---
> Emre ÜNAL
> 
> 
> 
> -- 
> ---
> Emre ÜNAL
> http://www.geocities.com/dusemre
> http://dusemre.blogspot.com
> ICQ: 5712269
> 
>    [[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.



More information about the R-help mailing list