[R] R CMD BUILD converting data file format?

Carl Witthoft
Fri, 28 Jan 2022 19:46:35 -0000

When I run the shell command

R CMD BUILD mypackage

the builder converts *.R files to *.rda data files.  This seems to
conflict with the information in R-Exts which says a package's  /data
directory can contain  foo.R files which the function data() will call
source() to execute.
In my case, I have a  foo.R file in the /data directory which contains
the following (adapted for size and clarity:


# some comment text
dataA <- '3.1415'
# more comments
dataB <- '2.71828'

The builder converted foo.R to foo.rda, and when I use either data() or
load() all I get is  a char vector containing the text

[1] 'dataA'
[2] 'dataB'

Where did I go wrong?

thanks

--
Carl Witthoft
carl at witthoft.com