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

Load R scripts from data/ folder with load_all() #45

Closed
aL3xa opened this Issue Jan 16, 2012 · 0 comments

Comments

Projects
None yet
2 participants
@aL3xa

aL3xa commented Jan 16, 2012

For (not so) strange and peculiar reason load_all() doesn't load the datasets from data/ folder if they're saved as .R scripts. I have a nice little function that loads the package and sources datasets to package namespace so everything runs smoothly:

l <- function(){
    load_all("<pkgpath>/")
    for (i in dir("<pkgpath>/data", pattern = "\\.R$", full.names = TRUE))
        sys.source(i, envir = as.environment("package:<pkgname>"))
}

I know what you think about loops (that they're awesome), but this works pour moi...

@hadley hadley closed this in 176859e Feb 23, 2012

@lock lock bot locked and limited conversation to collaborators Sep 19, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.