I'm relatively new to R. I'm trying to for loop but I keep getting an error message. Can anyone hint at what I am doing wrong please?
> m.control=c(1.45,9.40,9.96,4.2,1.86,0.2)
> m.sham=c(3.39,23.94,23.62,10.08,2.99,1.09)
>
> t=function(m, a){(1-exp(-a*m))} #t function defined
>
> d=function(ts, tc){(ts-tc)/ts} #d function defined
>
> pick.a=seq(0.01,2,by=0.01) #set of a values defined
>
> output=cbind(pick.a,d=rep(NA,length(pick.a))) #define array containing a values in column 1 and d values (outputs) in column 2
>
> for(count in 1:length(pick.a)){
+ ts=sum(t(m.sham),pick.a[count])
+ tc=sum(t(m.control),pick.a[count])
+ output[count,2]=(ts-tc)/ts
+ }
Error in -a : 'a' is missing
>
[[alternative HTML version deleted]]