Thanks a lot,

I understand what you say but I'm having problems - maybe with the syntax or
the specific command.

You are right - I have a dataframe to store the data and want to automate
the analysis.

i.e. I want do a chisq.test with to know if alcohol intake (Y/N) differs
between sexes, then if smoking (Y/N) differs between sexes, then if alcohol
intake or smoking differ by hiv status.

The command within my data frame for each individual comparison is e.g.

chisq.test(alcohol,sex)... then repeat it for all combination of variables.

but using lapply I'm still unsure how to design the loop.

I'll keep trying - let me know if you have more ideas.

Derek


--
View this message in context: 
http://r.789695.n4.nabble.com/Using-functions-loops-for-repetitive-commands-tp3498006p3499001.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.

Reply via email to