Re: [R] matching by gender and age

2011-06-17 Thread 1Rnwb
getting errors when running this file http://r.789695.n4.nabble.com/file/n3605311/il1ra_status.txt il1ra_status.txt > Age.co<-c(dat2b$Dr_Age) > Sex.co<-as.factor(dat2b$Sex) > casecont.co<-as.factor(dat2b$Self_T1D) > stat.co<-as.factor(dat2b$status) > > m <- matchControls(stat.co~Sex.co+Age.co,

Re: [R] matching by gender and age

2011-06-16 Thread 1Rnwb
the examples work great but it gives me this error on this file http://r.789695.n4.nabble.com/file/n3603737/il1ra_L.csv il1ra_L.csv > Age.co<-c(dat2b$Dr_Age) > Sex.co<-as.factor(dat2b$Sex) > casecont.co<-as.factor(dat2b$Self_T1D) > stat.co<-as.factor(dat2b$status) > > m <- matchControls(Sex.co~A

Re: [R] matching by gender and age

2011-06-03 Thread David Winsemius
On Jun 3, 2011, at 1:37 PM, 1Rnwb wrote: Thanks, for pointing out the package e1071, the example for matchControls is exactly what I am looking for, however how can I add additional factors to match for. library(e1071) Age.case <- 40 + 5 * rnorm(50) Age.cont <- 45 + 10 * rnorm(150) Age <- c

Re: [R] matching by gender and age

2011-06-03 Thread 1Rnwb
Thanks, for pointing out the package e1071, the example for matchControls is exactly what I am looking for, however how can I add additional factors to match for. library(e1071) Age.case <- 40 + 5 * rnorm(50) Age.cont <- 45 + 10 * rnorm(150) Age <- c(Age.case, Age.cont) Sex.case <- sample(c("M", "

Re: [R] matching by gender and age

2011-05-30 Thread David Winsemius
On May 30, 2011, at 11:30 AM, 1Rnwb wrote: 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

Re: [R] matching by gender and age

2011-05-30 Thread 1Rnwb
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

Re: [R] matching by gender and age

2011-05-26 Thread David Winsemius
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 quest

[R] matching by gender and age

2011-05-26 Thread 1Rnwb
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 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=