Does CRAN require separate files for each .R and .cpp function in packages?

I want to submit an R package to CRAN. All packages that I know have a separate .R or .cpp file for each of their .R or .cpp functions, respectively. Is this a necessary property for a package to be accepted by CRAN?

Upvotes: 0

Views: 59

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368439

No.

You could have all your R code in one file R/myfile.R and all your C++ code in src/myfile.cpp. But files are "transient" anyway in the sense that R now bytecompiles all R code into another internal representation, and of course always compiled native source code in C, C++, Fortran, ... as needed into object code that is loaded dynamically as needed.

You have to pass R CMD check --as-cran and adhere to the CRAN Repo Policy otherwise but there is no restriction that each function needs a source file -- entirely up to you to organise as you see fit.

Upvotes: 2

Related Questions