On May 26, 2011, at 11:19 AM, 1Rnwb wrote:
Hello R gurus, I have a data set from which i have to extract the
gender and
age matched rows from controls and disease group
You need to define what you mean by "age-matched". Your example
creates a very narrow age range which further adds questions about
what you are doing. You probably need to look at defining an age-
category variable with cut() and proceeding from there.
disease<-paste(rep(c('y','n'),11))
gender<-paste(rep(c('m','f'),11))
mcp<-rnorm(700,1400)
age<-rnorm(32,34)
dat<-
data.frame(disease=disease,sex=gender,Dr_age=age[1:22],MCP=mcp[1:22])
Use set.seed to generate a reproducible input and then tell us what
your expected output should be.
I have other categorical variables also to add to the matching. all
the
posts I came across are matching for a single column from two
matrix/dataframe. How can i match for multiple variables when all
the data
is in one single dataframe
David Winsemius, MD
West Hartford, CT
______________________________________________
R-help@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.