Bug 15758 - Error in save from environment
Summary: Error in save from environment
Alias: None
Product: R
Classification: Unclassified
Component: Language (show other bugs)
Version: R 3.1.0
Hardware: All All
: P5 enhancement
Assignee: R-core
Depends on:
Reported: 2014-04-17 22:10 UTC by Marek Szatkowski
Modified: 2014-04-23 09:10 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Marek Szatkowski 2014-04-17 22:10:06 UTC
Error shows when saving objects from environment:

    my_env <- new.env()
    my_env$one <- 1L
    save(one, file=tempfile(), envir=my_env)

    Error in save(one, file = tempfile(), envir = my_env) : 
      object 'one' not found

It's caused by check for non-empty list of objects to save:

    if (missing(list) && !length(list(...))) warning("nothing specified to be save()d")

list(...) fails cause object doesn't exist in it's scope.

I read related discussion on r-devel (http://markmail.org/thread/ywqkcrndcwmyyhya) and following change should match the requirements:

    names <- as.character(substitute(list(...)))[-1L]
    if (missing(list) && !length(names)) 
        warning("nothing specified to be save()d")
    list <- c(list, names)