[Rd] Package installation and path.package

Simon Zehnder szehnder at uni-bonn.de
Mon Sep 9 10:22:32 CEST 2013


Dear R-Devels,

I am writing right now my own package that makes use of 'tempfile' and there within with 'path.package'. When I install it, I get the error: Error in path.package("mypackage") : none of the packages are loaded. Here is the code, I use in my package:


".defaultDBPath"    <- function() 
{
    db.path <- tempfile(pattern     = "mmstructDB", 
                        tmpdir      = file.path(path.package("mmstruct"),
                                                "data", "databases"),
                        fileext     = ".db")
    return(db.path)
}

.mmstructBASE <- setClass("mmstructBASE",
                          		    representation("VIRTUAL",
                                                                    dbName     = "character",
                                                                    dbTable    = "character"),
                                            prototype(dbName      = character(),
                                                            dbTable     = character()
							    )
)

.mmstructDB <- setClass("mmstructDB",                        
                        representation("VIRTUAL",
                                       conn = "SQLiteConnection"),
                        contains = c("mmstructBASE"),
                        prototype(conn  = dbConnect(dbDriver("SQLite"), .defaultDBPath()))
)

I understand the error, but I would like to have a workaround. How can I give the path to the package I am actually installing without getting this error? 


Best

Simon


More information about the R-devel mailing list