[R] Help running a Fortran subroutine from R
cyr.derek at gmail.com
Tue Mar 16 23:03:51 CET 2010
I need help getting a Fortran DLL successfully returning the correct output.
The attached fortran source code (filter2d.f) and DLL (filter2d.dll) are
attached. Also, I attached a text file for which I want to apply the filter
Here is what I am doing...
Then I pass the parameters according to the order they are specified in the
array <- data.matrix(read.table("time702.txt",header=F))
array1 <- array
nx <- 60
ny <- 120
halfintx <- 3
halfinty <- 3
mask <- matrix(array(rep(1.0,25)),5,5)
subarray <- matrix(0,5,5)
subarray1 <- matrix(0,5,5)
Then I run the Fortran subroutine...
out <- .Fortran("filter2d",
The smoothed output is 'array1', which I just passed as 'array' in the
specification. It can be any matrix, but must be the same dimension as
'array', which is given as nx by ny.
Missing values in time702.txt are denoted by 999.00, and are defined that
way in the subroutine.
Can anyone see where I may be doing something wrong? I am not good with
fortran, as this code was previously written and now I am trying to adapt it
to R "on the fly".
Basically, filter2d smooths 'array' by averaging within the window halfintx
Can anyone please help me out or provide some clarification?
View this message in context: http://n4.nabble.com/Help-running-a-Fortran-subroutine-from-R-tp1595641p1595641.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help