[R] for loop or Hmisc library trap.rule function syntax error

Neil Skjodt neil.skjodt at ualberta.ca
Fri Mar 19 15:49:26 CET 2004


Hello:

I am new R user stumped why the R code after this paragraph generates "Error: 
syntax error" messages after each of the last 2 lines. I have tried searching 
the manuals, Hmisc documentation, contributed manuals, help archives, and 
Internet. I am running R 1.7.1 under Windows 2000 (I will upgrade when my 
imminent OS upgrade happens). My data was successfully entered and displayed 
as data.df whose first row is column labels, whose subsequent rows are 
separate subject results, whose 2nd to 7th columns are numeric control results 
(for observations at 0, 30, 60, 90, 120, and 180 min), and whose 8th to 13th 
columns are numeric treatment results. I am trying to enter the control and 
test area under the curve values from the Hmisc trap.rule function into 
"control" and "test" for hypothesis testing. I tried posting this last PM, but 
my message seems to have been lost. I apologize if this appears as a duplicate 
message. Thanks. Neil

...
control = c();		 
test = c();

for (subj in 1:11) {

  rownum = subj+1	  # add one to subject as first row is column labels
  control(subj)=trap.rule(c(0,30,60,90,120,180),c(data.df(subj,2:7))
  test(subj)=trap.rule(c(0,30,60,90,120,180),c(data.df(subj,8:13))
}
...




More information about the R-help mailing list