[18685] in s-news-athena
[S] looping with crosstabs command
daemon@ATHENA.MIT.EDU (Katki, Hormuzd (NCI))
Wed Jul 21 12:14:25 1999
Message-Id: <33A032D3B953D2119D750008C7A48E68CD06C0@nihexchange7.nih.gov>
From: "Katki, Hormuzd (NCI)" <katkih@mail.nih.gov>
To: "'s-news'" <s-news@wubios.wustl.edu>
Date: Wed, 21 Jul 1999 12:07:55 -0400
Mime-Version: 1.0
Content-Type: text/plain
Hi. I've noticed some problems when running the crosstabs command
inside a loop. What am I doing wrong?
1. SPlus crashes if the looping variable is a part of the crosstabs statement:
for (flag in c(40:44,46:50)) {
print(crosstabs(~sel.phn2[,flag]+sel.phn2[,10],na.action=na.exclude))
}
2. If you try to get around it by assigning the looping variable, then using
crosstabs, consecutive runs of the code will produce different unpredictable
results:
for (flag in c(40:44,46:50)) {
cases<-sel.phn2[,flag]
print(crosstabs(~cases+sel.phn2[,10],na.action=na.exclude))
}
Any ideas would be greatly appreciated. Thank you for your time,
Hormuzd Katki
Biostatistics Branch, Division of Cancer Epidemiology and Genetics
National Cancer Institute
6120 Executive Blvd. Room 8044 MSC 7244
Rockville, MD 20852-4910
301-594-7818 (voice)
301-402-0081 (fax)
katkih@mail.nih.gov
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news