Hi there,

Does anyone know how to extract data from a function that prints out two or more summaries? In the function below (the whole code is provided) we get 5 different tables of data. I would like to split each of these tables in a separate file (while the function itself shouldn't be changed), so that further analysis on each data set could be carried out. Your help is deeply appreciated. Have a good day. Ana


Here is the code:

library(MatchIt)

f <- treat ~ age + I(age^2) + educ + I(educ^2) + black + hispan +
    married + nodegree + re74 + I(re74^2) + re75 + I(re75^2)

d <- lalonde

m <- "nearest"

matching <- function(formula,data,method){
          library(MatchIt)
          m.out <- matchit(formula=f, data=d, method=m)
          print(m.out)
          print(summary(m.out))
}

matching(f,d,m)

	[[alternative HTML version deleted]]

