Search code examples
rfortransubroutineforecasting

R calling Fortran subroutine


I understood that .Fortran from following code invokes Fortran subroutine, but why we are using C_ for subroutine name here? Few other subroutine calling examples I looked over internet are simply "stl", can someone please help me with why C_stl instead of stl?

 z <- .Fortran(C_stl, x, n,
          as.integer(period),
          as.integer(s.window),
          as.integer(t.window),
          as.integer(l.window),
          s.degree, t.degree, l.degree,
          nsjump = as.integer(s.jump),
          ntjump = as.integer(t.jump),
          nljump = as.integer(l.jump),
          ni = as.integer(inner),
          no = as.integer(outer),
          weights = double(n),
          seasonal = double(n),
          trend = double(n),
          double((n+2*period)*5))

Solution

  • C_stl is an object in the stats package containing auxiliary information about the Fortran subroutine. It's not exported, so to see it you'll have to type stats:::C_stl.

    > stats:::C_stl
    $name
    [1] "stl"
    
    $address
    <pointer: 0x000000000f87b950>
    attr(,"class")
    [1] "RegisteredNativeSymbol"
    
    $dll
    DLL name: stats
    Filename: E:/apps/R/R-3.1.1/library/stats/libs/x64/stats.dll
    Dynamic lookup: FALSE
    
    $numParameters
    [1] 18
    
    attr(,"class")
    [1] "FortranRoutine"   "NativeSymbolInfo"