From h.wickham at gmail.com  Wed Aug 27 20:49:04 2014
From: h.wickham at gmail.com (Hadley Wickham)
Date: Wed, 27 Aug 2014 13:49:04 -0500
Subject: [Rd] no visible binding for global variable for data sets in a
	package
In-Reply-To: <53FE1A8F.3060809@yorku.ca>
References: <53FD030A.1020709@yorku.ca>
	<21501.41940.216907.982935@stat.math.ethz.ch>
	<53FDDD55.1040807@yorku.ca> <53FDE608.40801@yorku.ca>
	<D13961DB-34D8-4A33-B01E-D8F8BECCB501@gmail.com>
	<53FE1A8F.3060809@yorku.ca>
Message-ID: <CABdHhvE8geMgcOcXr8YsKqNd1FSWdehG1xE1emeVXos-5RTKzg@mail.gmail.com>

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/



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