Open GoogleCodeExporter opened 8 years ago
Thanks for this. The fail is not to do with the loop in Fortran. It is an issue
with IStatConnector_SetSymbol which does not evaluate the string param[i] ...
which would become param[1] on the first iteration but somehow manages to
create a new variable called "param[i]". It assigns the value to this new
variable. The setting routine takes a literal approach to the variable name.
There are several workarounds for this. The key is to not use Rput to assign a
value to something in R that requires evaluation, i.e. the "[i]" part.
1. Create the whole array in Fortran and tranfer it in one hit.
2. Pass the data: Rput("temp",par) and then assign it within R:
Reval("param[i]=temp")
Original comment by Michael....@gmail.com
on 3 Nov 2011 at 12:47
A note for future development:
Either
1. Submit bug report to StatCon and get IStatConnector_SetSymbol to evaluate
expressions.
2. Replace Rput() with a fortran function that formalises the workaround above,
e.g.
function RputFIXED(var,val) result(ok)
!... declare variables
ok = RPut("temp",val) ! first dump the data in R
ok = Reval(trim(var)//"=temp") ! evaluate any expression in var and assign temp to it
end function
Original comment by Michael....@gmail.com
on 3 Nov 2011 at 12:52
Original issue reported on code.google.com by
j...@civeng.adelaide.edu.au
on 4 Aug 2011 at 6:39Attachments: