On Apr 9, 2010, at 8:16 AM, Iurie Malai wrote:
I want to run Shapiro-Wilk test for each variable in my dataset, each
grouped by variable groupFactor.
I have these working commands:
data.n<-names(data) # put names into a vector called data.n
by(eval(parse(text=(paste("data",data.n[3],sep="$")))), data
$factor, shapiro.test) #run shapiro.test
but I must to change the variable number manualy. How to automate
this?
I tried this:
for (r in 3:18) {
by(eval(parse(text=(paste("data",data.n[3],sep="$")))), data
$groupFactor, shapiro.test)
}
Not able to test since you have provided code that works with data
that is not available. Inside for loops one needs either to make an
assignment or print the results. Had the data been available I would
have wrapped print() around the full by expression to see if my
hypothesis could be tested.
--
David.
but not working and no errors. Why?
Please help.
--
Regards,
Iurie Malai, Senior Lecturer
Department of Psychology
Faculty of Psychology and Special Education
Ion Creanga Moldova Pedagogical State University - www.upsm.md
http://en.wikipedia.org/wiki/Ion_Creang%C4%83_Pedagogical_State_University
______________________________________________
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.
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.