[Roxygen-devel] [roxygen2] error sourcing the R files (probably environment issue)

Renaud Gaujoux renaud at cbio.uct.ac.za
Wed Sep 21 22:46:15 CEST 2011


Forgot the traceback:

 > traceback()
12: eval(expr, envir, enclos)
11: eval(assignee, env)
10: parser(call, env)
9: FUN(X[[1L]], ...)
8: lapply(src_refs, parse.srcref, env = env)
7: force(code)
6: parse_cache$compute(c(env_hash, readLines(file, warn = FALSE)),
        {
            src_refs <- attributes(parse(srcfile$filename, srcfile = 
srcfile))$srcref
            pre_refs <- prerefs(srcfile, src_refs)
            if (length(src_refs) == 0)
                return(list())
            src_parsed <- lapply(src_refs, parse.srcref, env = env)
            pre_parsed <- lapply(pre_refs, parse.preref)
            stopifnot(length(src_parsed) == length(pre_parsed))
            mapply(c, src_parsed, pre_parsed, SIMPLIFY = FALSE)
        })
5: FUN("/home/renaud/Documents/tmp/test/R/fun.R"[[1L]],
        ...)
4: lapply(paths, parse.file, env = env, env_hash = env_hash)
3: unlist(lapply(paths, parse.file, env = env, env_hash = env_hash),
        recursive = FALSE)
2: parse.files(r_files)
1: roxygenise(".")

-- 
Renaud Gaujoux
Computational Biology - University of Cape Town
South Africa


On 21/09/2011 21:38, Hadley Wickham wrote:
>> in one of the R files I have something like this, that defines a temporary
>> function in order to define a static variable:
>>
>> f<- function(){
>>     .a<- 0
>>     function(x=1){
>>         .a<<- .a + x
>>         .a
>>     }
>> }
>> f2<- f()
>> rm(f)
>>
>> When running roxygenise on this I get the error:
>> Error in eval(expr, envir, enclos) : object 'f' not found
> What does traceback give you?  Could you provide a small reproducible example?
>
> Hadley
>
>



###

UNIVERSITY OF CAPE TOWN 

This e-mail is subject to the UCT ICT policies and e-mail disclaimer published on our website at http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from +27 21 650 9111. This e-mail is intended only for the person(s) to whom it is addressed. If the e-mail has reached you in error, please notify the author. If you are not the intended recipient of the e-mail you may not use, disclose, copy, redirect or print the content. If this e-mail is not related to the business of UCT it is sent by the sender in the sender's individual capacity.

###
 



More information about the Roxygen-devel mailing list