I've moved nlme from Depends to Imports in my coxme package. However, a few of the examples for lmekin use one of the data sets from nlme. This is on purpose, to show how the results are the same and how they differ. If I use data(nlme::ergoStool) the data is not found, data(nlme:::ergoStool) does no better. If I add importFrom(nlme, "ergoStool") the error message is that ergoStool is not exported. There likely is a simple way, but I currently don't see it. Terry T.
Import data set from another package?
6 messages · Brian G. Peterson, Hadley Wickham, Jeroen Ooms +2 more
On 03/02/2015 04:48 PM, Therneau, Terry M., Ph.D. wrote:
I've moved nlme from Depends to Imports in my coxme package. However, a few of the examples for lmekin use one of the data sets from nlme. This is on purpose, to show how the results are the same and how they differ. If I use data(nlme::ergoStool) the data is not found, data(nlme:::ergoStool) does no better. If I add importFrom(nlme, "ergoStool") the error message is that ergoStool is not exported. There likely is a simple way, but I currently don't see it.
In your examples, can't you use:
data("ergoStool", package="nlme")
?
That is how a user would call it if they wished to use the dataset.
Regards,
Brian
Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock
How about just nlme::ergoStool ? Hadley On Mon, Mar 2, 2015 at 4:48 PM, Therneau, Terry M., Ph.D.
<therneau at mayo.edu> wrote:
I've moved nlme from Depends to Imports in my coxme package. However, a few of the examples for lmekin use one of the data sets from nlme. This is on purpose, to show how the results are the same and how they differ. If I use data(nlme::ergoStool) the data is not found, data(nlme:::ergoStool) does no better. If I add importFrom(nlme, "ergoStool") the error message is that ergoStool is not exported. There likely is a simple way, but I currently don't see it. Terry T.
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
You could add something like this to your package:
.onLoad <- function(libname, pkgname){
data(ergoStool, package="nlme", envir = environment(.onLoad));
}
This should basically do the same as importFrom(nlme, "ergoStool") but
then for a lazy load dataset.
On Mon, Mar 2, 2015 at 2:48 PM, Therneau, Terry M., Ph.D.
<therneau at mayo.edu> wrote:
I've moved nlme from Depends to Imports in my coxme package. However, a few of the examples for lmekin use one of the data sets from nlme. This is on purpose, to show how the results are the same and how they differ. If I use data(nlme::ergoStool) the data is not found, data(nlme:::ergoStool) does no better. If I add importFrom(nlme, "ergoStool") the error message is that ergoStool is not exported. There likely is a simple way, but I currently don't see it. Terry T.
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
On 02/03/2015 22:48, Therneau, Terry M., Ph.D. wrote:
I've moved nlme from Depends to Imports in my coxme package. However, a few of the examples for lmekin use one of the data sets from nlme. This is on purpose, to show how the results are the same and how they differ. If I use data(nlme::ergoStool) the data is not found, data(nlme:::ergoStool) does no better. If I add importFrom(nlme, "ergoStool") the error message is that ergoStool is not exported. There likely is a simple way, but I currently don't see it.
There were some off-the-mark suggestions in this thread. If you just
want a dataset from a package, use
data("ergoStool", package = "nlme")
In particular, it is somewhat wasteful to load a large namespace like
nlme when it is not needed.
Brian D. Ripley, ripley at stats.ox.ac.uk Emeritus Professor of Applied Statistics, University of Oxford 1 South Parks Road, Oxford OX1 3TG, UK
As I expected: there was something simple and obvious, which I somehow could not see. Thanks for the pointer. Terry T.
On 03/03/2015 03:12 AM, Prof Brian Ripley wrote:
On 02/03/2015 22:48, Therneau, Terry M., Ph.D. wrote:
I've moved nlme from Depends to Imports in my coxme package. However, a few of the examples for lmekin use one of the data sets from nlme. This is on purpose, to show how the results are the same and how they differ. If I use data(nlme::ergoStool) the data is not found, data(nlme:::ergoStool) does no better. If I add importFrom(nlme, "ergoStool") the error message is that ergoStool is not exported. There likely is a simple way, but I currently don't see it.
There were some off-the-mark suggestions in this thread. If you just want a dataset from
a package, use
data("ergoStool", package = "nlme")
In particular, it is somewhat wasteful to load a large namespace like nlme when it is not
needed.