Re: [R] matching by gender and age

From: 1Rnwb <sbpurohit_at_gmail.com>
Date: Mon, 30 May 2011 08:30:50 -0700 (PDT)

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.

______________________________________________
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.
Received on Mon 30 May 2011 - 15:45:59 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 17 Jun 2011 - 03:20:15 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive