You can pre-process your R files with the brew package, for example.
File 'foo-tmp.r'
#
#
#
#
#
#
#
#
#
#
#<%= cat(paste0("##'", getSrcref(foo), "\n")) %>
foo <- function(x, y, z){
rnorm(10) == 1
# inline comment
.NotYetImplemented()
" other stuff"
return(FALSE)
}
Then process the file to generate foo.r
source("foo-tmp.r")
brew("foo-tmp.r", "foo.r")
with the resulting output:
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
foo <- function(x, y, z){
rnorm(10) == 1
.NotYetImplemented()
" other stuff"
return(FALSE)
}
source
share