Just enter your email
I prefer putting my data, and only my data, into an R data package.
1. You can easily use your data in another analysis with a simple "library(mydata)".
2. There is a built-in documentation system to provide the codebook, which is accessible with a simple "?mydata".
3. Easy to share with other R users, who will immediately know how to explore your data.
Here is why I'm not (yet) convinced, however, that R packages are the best format for an analysis:
1. R packages are designed to be "built" and installed in your package library to provide additional functionality to R. This makes sense for data, which you might use in multiple analyses, and it makes sense for functions that will be useful in multiple analyses, but doesn't make sense for an analysis itself.
2. The package system is finicky. It's easy to break a package so it won't build. The more features of the package system you use, the more likely you are to break something. Finding and fixing build errors is not trivial without a thorough knowledge of packages (in my experience).
3. Not super intuitive how you "use" an analysis package.
4. You typically have two versions of a package on your system: the source version, and the built version that is installed. These easily get out of sync.
5. Using the package format for analyses is ultimately a hack, and not in a good way.
Instead of using the R package format, I think it would be neat to engineer a lightweight format for distributing analyses, perhaps closer in spirit to an RStudio project than an R package. One part would be an easy way to specify the computational environment, e.g., package dependencies, optionally including your data package (in lieu of a data package, however, it might simply point to the data directory). A second part would be an easy way to specify the analysis, e.g., run these scripts.
A huge feature would simply be to verify that the analysis will run on an arbitrary modern system. My students always send me scripts that contain hard-coded paths that are unique to their systems, for example, and that point to files and directories that I don't have. Annoying.
Such a system would a real boon for both teaching and research.
My two cents.