[R] grouping data

From: Subhabrata <subhabratapal_at_sraindia.com>
Date: Sat 24 Dec 2005 - 18:31:48 EST


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



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 Sat Dec 24 18:39:32 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:40 EST