[R] grouping data

Subhabrata subhabratapal at sraindia.com
Sat Dec 24 08:31:48 CET 2005


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


More information about the R-help mailing list