[R] Cleaning up workspace

Duncan Murdoch murdoch.duncan at gmail.com
Wed Oct 16 17:12:29 CEST 2013


This has been reported before on the bug list 
(https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15481).  The 
message is coming from the methods package, but I don't know if it's a 
bug or ignorable.

Duncan Murdoch

On 16/10/2013 11:03 AM, Prof J C Nash (U30A) wrote:
> In order to have a clean workspace at the start of each chapter of a
> book I'm "knit"ing I've written a little script as follows:
>
> # chapclean.R
> # This cleans up the R workspace
> ilist<-c(".GlobalEnv", "package:stats", "package:graphics",
> "package:grDevices",
> "package:utils", "package:datasets", "package:methods", "Autoloads",
> "package:base")
> print(ilist)
> xlist<-search()[which(!(search() %in% ilist))]
> print(xlist)
> for (ff in xlist){
>      cat("Detach ",ff," which is pos ",as.integer(which(ff ==
> search())),"\n")
>      detach(pos=as.integer(which(ff == search())), unload=TRUE) # ?? do
> we need unload
> }
> rm(list=ls())
>
>
> This appears to "work" fine in my system -- session info is below, but I
> get 30 warnings of the type
>
> 30: In FUN(X[[2L]], ...) :
>     Created a package name, ‘2013-10-16 10:56:47’, when none found
>
> Does anyone have ideas why the warnings are being generated?  I'd like
> to avoid suppressing them. Here's the session info.
>
> R version 3.0.1 (2013-05-16)
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> locale:
>    [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C
>    [3] LC_TIME=en_CA.UTF-8        LC_COLLATE=en_CA.UTF-8
>    [5] LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_CA.UTF-8
>    [7] LC_PAPER=C                 LC_NAME=C
>    [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> loaded via a namespace (and not attached):
> [1] tools_3.0.1
>   >
>
> John Nash
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list