Perfect, thanks! (Any idea if/where this is documented? I checked through the "Writing R Extensions" doc and couldn't find any mention of it.)
Thanks much again, -Murat On Thu, Dec 3, 2015 at 6:42 PM, William Dunlap <wdun...@tibco.com> wrote: > Every package has in it, after it is installed, a character object > called ".packageName" containing its name. It is not exported from > the package. Functions in your package can refer to it as just > .packageName. > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > > On Thu, Dec 3, 2015 at 5:28 PM, Murat Tasan <mmu...@gmail.com> wrote: >> In a package I'm writing, I'm placing all SQL code here: >> /inst/sql/ >> >> And so when referring to these blocks of code from the package's R >> code, I do something like so: >> >> system.file("sql", "my_example_file.sql", package = "ThisPackage", >> mustWork = TRUE) >> >> But, referring to the package itself with the string "ThisPackage" is >> annoying and somewhat brittle... if the package were ever to change >> names (e.g. during development), I'll have to replace all such calls >> with the new package name. >> And generally referring to the package containing the code itself by >> name seems inelegant. >> >> Anyone know of a safe way to reference additional files in a package, >> from within that package's code, that doesn't require specifying the >> name of the package as a string? >> >> Cheers, >> >> -Murat >> >> ______________________________________________ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.