Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error sourcing the R files (probably environment issue) #42

renozao opened this issue Sep 22, 2011 · 0 comments

error sourcing the R files (probably environment issue) #42

renozao opened this issue Sep 22, 2011 · 0 comments


Copy link

@renozao renozao commented Sep 22, 2011

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
     .a<<- .a + x
f2<- f()

When running roxygenise on this I get the error:
Error in eval(expr, envir, enclos) : object 'f' not found

If on removes the call to rm, there is no error.

> 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)
           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(".")
@hadley hadley closed this in 00d08f6 Oct 25, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants