Welcome to the sixth post in the really random R riffs series, or R4 for short.
Posts #1 and #2 discussed how to get the now de rigeur package registration information computed. In essence, we pointed to something which R 3.4.0 would have, and provided tricks for accessing it while R 3.3.3 was still R-released.
#!/usr/bin/r if (getRversion() < "3.4.0") stop("Not available for R (< 3.4.0). Please upgrade.", call.=FALSE) tools::package_native_routine_registration_skeleton(".")
So with this example script
pnrrs.r soft-linked to
~/bin) as I commonly do with littler helpers, all it takes is
cd some/R/package/source pnrrs.r
and the desired file usable as
src/init.c is on
NAMESPACE is quick too, and we’re all done. See the other two posts for additional context. If you don’t have littler, the above also works with