Hi,
How are the datasets loaded in the first place?
If it uses readRDS you set the name.
If you use load or data it returns the name of the objects loaded:
(data("datasets"))
## "obj1", "obj2", "obj3", "obj4"
If there are multiple you can collect them to just display them once:
treg <- data("treg")
cytof <- data(cytof)
c(treg, cytof)
# "treg", "cytof"
Cheers,
Lluís
Missatge de Kevin R. Coombes <[email protected]> del dia dt.,
17 de febr. 2026 a les 19:41:
>
> Hi,
>
> I have an R package (RPointCloud) that contains three vignettes. Each
> vignette starts by loading a different example dataset, and then calls
> "ls" to show the reader what objects were loaded. It is abundantly clear
> that the vignettes are all produced in the same R process. Thus, the
> "ls" in the later vignettes includes a list of all objects created
> during earlier vignettes. Since each vignette is really intended to be
> standalone, these lists are misleading.
>
> In an early submission of the package, I included a command at the end
> of the form "rm(list = ls())", which I removed after objections from a
> CRAN reviewer that this process could/would remove things that a user
> already had in their workspace before they started running the vignette
> themselves. So, I took those commands out.
>
> What is the best way to ensure that objects are not carried over from
> one vignette to another? I am thinking about the following:
>
> # at the top of each vignette:
> origobj <- ls()
>
> # at the bottom of each vignette
> currobj <- ls()
> ourobj <- currobj[!(currobj %in% origobj)]
> rm(list = ourobj
>
> Will this procedure pass the CRAN review? Is there a better way to
> accomplish this goal?
>
> Thanks,
> Kevin
>
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel