Hi, The following call does not work:
dfhosp=dat.2.wide.sub %>% group_by(HOSP_NRD)%>% do(fitHosp=lm(log(y)~ log(x)+I(log(x)^2)+NCHRONIC+AGE+sex ,data=.)) Error in `$<-.data.frame`(`*tmp*`, "sex", value = integer(0)) : replacement has 0 rows, data has 25174 When I use "sex" as a binary variable with values "0" and "1", it works. Is there a way to use factor in this call? Thanks. V.K.Chetty -- Professor of Family Medicine Boston University Tel: 617-414-6221, Fax:617-414-3345 emails: chett...@gmail.com,vche...@bu.edu [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.