If you look at data(package="Ecat")$results[,"Item"] you will see the items "Hstarts", "Hstarts (Intratesm)", and "Hstarts (Intratesq)" which I think means that the dataset Hstarts is found in 3 .rda files, "Hstarts.rda", "Intratesq.rda", and "Intratesm.rda". There are duplicate, modulo (filename), items for "MedExp" as well.
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -----Original Message----- > From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] On > Behalf > Of Spencer Graves > Sent: Tuesday, May 21, 2013 12:21 PM > To: Prof Brian Ripley > Cc: r-devel@r-project.org > Subject: Re: [Rd] Objects created by more than one data call? > > On 5/21/2013 9:03 AM, Prof Brian Ripley wrote: > > On 21/05/2013 16:51, Spencer Graves wrote: > >> On 5/21/2013 7:47 AM, Prof Brian Ripley wrote: > >>> On 21/05/2013 15:28, Spencer Graves wrote: > >>>> On 5/20/2013 10:10 PM, Prof Brian Ripley wrote: > >>>>> On 21/05/2013 00:12, Spencer Graves wrote: > >>>>>> Hello, All: > >>>>>> > >>>>>> > >>>>>> If I use LazyData with the Ecdat package on R-Forge, "R CMD > >>>>>> check" reports "no visible binding for global variable > >>>>>> 'nonEnglishNames'", where 'nonEnglishNames' is a dataset in Ecdat > >>>>>> used > >>>>>> as the default argument for a function. With LazyData, that NOTE > >>>>>> disappears. However, then I get, "Warning: objects 'Hstarts', > >>>>>> 'Hstarts', 'MedExp' are created by more than one data call". > >>>>>> > >>>>>> > >>>>>> What do you suggest I do to fix this problem? > >>>>> > >>>>> Not create the objects in more than one data() call. > >>>>> > >>>>> Check what each of your data() calls produces. > >>>> > >>>> > >>>> Thanks. How do I do that? > >>> > >>> Call data() on each in turn, and see what files get added to an empty > >>> workspace. > >> > >> > >> Like the following? > > > > You missed the 'empty'. Look at tools:::data2LazyLoadDB to see how > > this is checked. > > > Thanks for the suggestion. Unfortunately, I tried that function, > including stepping through it line by line, fixing references to other > functions not exported from tools, without enlightenment; see below. > > > Thanks again, > Spencer > > > > lib.loc = NULL > > package='Ecdat' > > pkgpath <- find.package(package, lib.loc, quiet = TRUE) > > pkgpath > [1] "C:/Users/sgraves/pgms/R/R-3.0.0/library/Ecdat" > > dataDir <- file.path(pkgpath, "data") > > dataDir > [1] "C:/Users/sgraves/pgms/R/R-3.0.0/library/Ecdat/data" > > enc <- tools:::.read_description(file.path(pkgpath, > "DESCRIPTION"))["Encoding"] > > enc > <NA> > NA > > if (!is.na(enc)) { > + op <- options(encoding = enc) > + on.exit(options(encoding = op[[1L]])) > + } > > file_test("-d", dataDir) > [1] TRUE > > file.path(dataDir, "Rdata.rds") > [1] "C:/Users/sgraves/pgms/R/R-3.0.0/library/Ecdat/data/Rdata.rds" > > (file.exists(file.path(dataDir, "Rdata.rds")) && > file.exists(file.path(dataDir, > + paste(package, "rdx", sep = "."))) && > file.exists(file.path(dataDir, > + paste(package, "rdb", sep = ".")))) > [1] FALSE > > file.exists(file.path(dataDir, > + paste(package, "rdx", sep = "."))) > [1] FALSE > > file.path(dataDir, > + paste(package, "rdx", sep = ".")) > [1] "C:/Users/sgraves/pgms/R/R-3.0.0/library/Ecdat/data/Ecdat.rdx" > > dataEnv <- new.env(hash = TRUE) > > tmpEnv <- new.env() > > f0 <- files <- list_files_with_type(dataDir, "data") > Error: could not find function "list_files_with_type" > > f0 <- files <- tools:::list_files_with_type(dataDir, "data") > > files <- unique(basename(file_path_sans_ext(files, > + TRUE))) > Error in basename(file_path_sans_ext(files, TRUE)) : > could not find function "file_path_sans_ext" > > files <- unique(basename(tools:::file_path_sans_ext(files, > + TRUE))) > > dlist <- vector("list", length(files)) > > files > character(0) > > names(dlist) <- files > > loaded <- character(0L) > > loaded > character(0) > > for (f in files) { > + utils::data(list = f, package = package, lib.loc = > lib.loc, > + envir = dataEnv) > + utils::data(list = f, package = package, lib.loc = > lib.loc, > + envir = tmpEnv) > + tmp <- ls(envir = tmpEnv, all.names = TRUE) > + rm(list = tmp, envir = tmpEnv) > + dlist[[f]] <- tmp > + loaded <- c(loaded, tmp) > + } > > dup <- duplicated(loaded) > > dup > logical(0) > > if (any(dup)) > + warning(sprintf(ngettext(sum(dup), "object %s is > created by more than one data call", > + "objects %s are created by more than one data call"), > + paste(sQuote(loaded[dup]), collapse = ", ")), > + call. = FALSE, domain = NA) > > if (length(loaded)) { > + dbbase <- file.path(dataDir, "Rdata") > + makeLazyLoadDB(dataEnv, dbbase, compress = compress) > + saveRDS(dlist, file.path(dataDir, "Rdata.rds"), > + compress = compress) > + unlink(f0) > + if (file.exists(file.path(dataDir, "filelist"))) > + unlink(file.path(dataDir, c("filelist", "Rdata.zip"))) > + } > > > > > > >> > >> > >> > library(Ecdat) > >> > objects() > >> character(0) > >> > (data(Hstarts)) > >> [1] "Hstarts" > >> > (data(MedExp)) > >> [1] "MedExp" > >> > objects() > >> [1] "Hstarts" "MedExp" > >> > sessionInfo() > >> R version 3.0.0 (2013-04-03) > >> Platform: i386-w64-mingw32/i386 (32-bit) > >> > >> locale: > >> [1] LC_COLLATE=English_United States.1252 > >> [2] LC_CTYPE=English_United States.1252 > >> [3] LC_MONETARY=English_United States.1252 > >> [4] LC_NUMERIC=C > >> [5] LC_TIME=English_United States.1252 > >> > >> attached base packages: > >> [1] stats graphics grDevices utils datasets methods base > >> > >> other attached packages: > >> [1] Ecdat_0.2-3 > >> > >> loaded via a namespace (and not attached): > >> [1] tools_3.0.0 > >> > >> > >> Thanks, > >> Spencer > >> > >>> > >>>> In the "man" directory, I just did "grep 'data(MedExp' *.Rd", > >>>> which identified only "MedExp.Rd:\usage{data(MedExp)}"; "grep > >>>> 'data(Hstarts *.Rd" similarly returned only > >>>> "Hstarts.Rd:\usage(data(Hstarts)}". > >>>> > >>>> > >>>> Thanks again for the reply. > >>>> Spencer > >>>>> > >>>>>> > >>>>>> Thanks, > >>>>>> Spencer Graves > >>>>>> > >>>>>> > >>>>>> > sessionInfo() > >>>>>> R version 3.0.0 (2013-04-03) > >>>>>> Platform: i386-w64-mingw32/i386 (32-bit) > >>>>>> > >>>>>> locale: > >>>>>> [1] LC_COLLATE=English_United States.1252 > >>>>>> [2] LC_CTYPE=English_United States.1252 > >>>>>> [3] LC_MONETARY=English_United States.1252 > >>>>>> [4] LC_NUMERIC=C > >>>>>> [5] LC_TIME=English_United States.1252 > >>>>>> > >>>>>> attached base packages: > >>>>>> [1] stats graphics grDevices utils datasets methods base > >>>>>> > >>>>>> other attached packages: > >>>>>> [1] Ecdat_0.2-3 > >>>>>> > >>>>>> loaded via a namespace (and not attached): > >>>>>> [1] tools_3.0.0 > >>>>>> > >>>>>> ______________________________________________ > >>>>>> R-devel@r-project.org mailing list > >>>>>> https://stat.ethz.ch/mailman/listinfo/r-devel > > > > > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel