[Rd] no visible binding for global variable for data sets in a package

Hadley Wickham h.wickham at gmail.com
Wed Aug 27 20:49:04 CEST 2014


On Wed, Aug 27, 2014 at 12:51 PM, Michael Friendly <friendly at yorku.ca> wrote:
> On 8/27/2014 10:41 AM, peter dalgaard wrote:
>>
>> Using data() in a package with lazyloaded data seems like asking for
>> trouble to me. But you're making me curious (and I'm too lazy[*] to set up
>> for rebuilding the package myself):
>>
>> Did you actually try putting battingLabels & friends in the namespace?
>> What happened?
>
> Well, I tried this, with NAMESPACE as
>
> # all the rest is data, except we try to export the data sets used globally
> in these functions
>
> export(battingStats,
>     playerInfo,teamInfo,
>     Label,
>     battingLabels, pitchingLabels, fieldingLabels,
>     Batting, Master, Teams
>     )
>
> R CMD check was even more unhappy, failing immediately, so the attempted
> cure was worse than the original disease.

If you want to export your datasets, you'll need to put them in R/sysdata.rda.

But I think Brian suggested the right fix: use Lahmann::Batting
instead of Batting. (And leave everything else as is)

Hadley

-- 
http://had.co.nz/



More information about the R-devel mailing list