Hello,
You are using the function ?t(), matrix transpose, with more than one
argument. What is that supposed to do? The error message says that the
other two arguments are not used (because they are illegal). And you
don't need to transpose a vector to sum its components.
Hope this helps,
Rui Barradas
Em 11-01-2014 18:46, Mathew Nagendran escreveu:
Hi all I am relatively new to R. I am trying to create a nested for loop but i
keep getting an error message (unused argument). Can someone help me find out
where I am goign wrong?
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.control=function(m, a){(1-exp(-a*m))}
t.sham=function(m, a, d){(1-exp(-a*(1-d)*m))}
t.ratio=function(ts, tc){(ts/tc)}
pick.a=seq(0.01,2,by=0.01) #set of a values defined
pick.d=seq(0.01,1,by=0.01) #set of d values defined
output=array(NA,c(length(pick.a), length(pick.d))) #define array for Ts/Tc
ratios. a values (0.01-2) in column 1 and d values (0.01-1) in the other
columns.
for(count in 1:length(pick.a)){
+ for(count in 1:length(pick.d)){
+ ts=sum(t(m.sham,pick.a[count],pick.d[count]))
+ tc=sum(t(m.control,pick.a[count]))
+ output[count,2]= (ts/tc)
+ }
+ print(output)
+ }
Error in t(m.sham, pick.a[count], pick.d[count]) :
unused argument(s) (pick.a[count], pick.d[count])
[[alternative HTML version deleted]]
______________________________________________
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.
______________________________________________
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.