[R] matching by gender and age

1Rnwb sbpurohit at gmail.com
Mon May 30 17:30:50 CEST 2011


I hope this modified example will work 
set.seed(100)    
disease<-paste(rep(c('y','n'),50))
    gender<-c(paste(rep(c('m','f'),25)), paste(rep(c('f','m'),25)))
    mcp<-rnorm(100, mean=1000,sd=600)
    age<-rnorm(100,mean=32,sd=20)

    dat<-data.frame(disease=disease,sex=gender,Dr_age=age,MCP=mcp)


the output should be very closely in age for equal number of disease and
gender.
 disease sex   Dr_age       MCP
99       y   f 25.87435 -534.4172
93       y   f 65.60017 1741.8817
47       y   m 46.15360  407.0412
19       y   m 26.24546  910.1833
24       n   f 66.53540 1343.3980
30       n   f 47.21835  888.0062
78       n   m 42.75345 1605.1334
82       n   m 27.05292 1671.9386
> 



--
View this message in context: http://r.789695.n4.nabble.com/matching-by-gender-and-age-tp3552825p3561009.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list