Re: [R] grouping data

From: Sumanta Basak <sumantab_at_ambaresearch.com>
Date: Mon 26 Dec 2005 - 20:45:53 EST


Hi Subhabrata,

I'm not totally sure what you are looking for. You can try to separate both male and female category by creating subset.

t<- read.csv ("agesubject1.csv", header = TRUE)

t.male<-subset(t,sex=="male")
t.female<-subset(t,sex="female")

See whether you want this??

Thanks & Regards,
SUMANTA BASAK. -----Original Message-----
From: r-help-bounces@stat.math.ethz.ch
[mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Subhabrata Sent: Saturday, December 24, 2005 1:02 PM To: r-help
Subject: [R] grouping data

Hello R-users/experts,

I am new to R-

I have a simple question:

Let say I have a data set as follows

temp:[file attached]

the data structure is a follows:

      sex         age
      female 28
      female 53
      female 53
      female 36
      male 42
      male 29
      male 43
      male 36
      male 41


Here we are grouping all male value into male and all female value in to female

as follows:

t<- read.csv("agesubject1.csv", header = TRUE)

male <- t$age[t$sex == "male"]
female <- t$age[t$sex == "female"]

Now say for example I have a similar data setas follows:

      sex               age time
      female 28 1
      female 53 2
      female 53 3
      female 36 4
      male 42 4
      male 29 4
      male 43 5
      male 36 6
      male 41 7



Now I want to accept both the values male and female.

Is it possible. i.e. instead of onle age I want age and time both.

So all ages for male and their corresponding time will be loaded.

Thanks for any help

With Regards
Subhabrata Pal



This e-mail may contain confidential and/or privileged infor...{{dropped}}

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Dec 26 20:57:12 2005

This archive was generated by hypermail 2.1.8 : Mon 26 Dec 2005 - 23:54:21 EST