[Rd] about integration of a library into package creation
hello, i try to create a package , and i call a library in the namespace file such as : useDynLib(quadprog) after checking my directory with the command "rcmd check" (i am on WindowsXP) i get an error: package / namespace load failed the path of the library is: D:\R\library\quadprog the path of the building files is: D:\RBuild\svcR and the comand i use to compile is: rcmd check D://RBuild//svcR i dont understand, it is a path problem about the dll related to the library ? thank for help Nicolas * checking package subdirectories ... WARNING Subdirectory 'src' contains no source files. * checking R files for syntax errors ... OK * checking R files for library.dynam ... OK * checking S3 generic/method consistency ... WARNING Erreur : le chargement du package / espace de noms a echoue' pour 'svcR' Sequence d'appel : 2: stop(gettextf("package/namespace load failed for '%s'", libraryPkgName(packag e)), call. = FALSE, domain = NA) 1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE) Execution arrete'e See section 'Generic functions and methods' of the 'Writing R Extensions' manual. * checking replacement functions ... WARNING Erreur : le chargement du package / espace de noms a echoue' pour 'svcR' Sequence d'appel : 2: stop(gettextf("package/namespace load failed for '%s'", libraryPkgName(packag e)), __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] about integration of a library into package creation
> > >You didn't show the results of installing your package. Did that work? > >Generally we advise to do a successful install before you try to run checks. > >Duncan Murdoch D:\RBuild\svcR> rcmd build D://RBuild//svcR --force --docs='all' --binary hence i obtain the file svcR_1.0.zip and following messages : D:\RBuild\svcR>rcmd build D://RBuild//svcR --force --docs='all' --binary * checking for file 'D://RBuild//svcR/DESCRIPTION' ... OK * preparing 'D://RBuild//svcR': * checking DESCRIPTION meta-information ... OK * cleaning src * removing junk files tar: svcR/svcR_1.0.tar: file is the archive; not dumped * excluding invalid files from 'svcR' Subdirectory 'R' contains invalid file names: ade4.dll quadprog.dll spdep.dll * checking for LF line-endings in source files * checking for empty or unneeded directories * building binary distribution WARNING * some HTML links may not be found installing R.css in C:/DOCUME~1/Nicolas/LOCALS~1/Temp/Rinst249298526 Using auto-selected zip options '' -- Making package svcR adding build stamp to DESCRIPTION installing NAMESPACE file and metadata installing R files installing data files installing man source files installing indices not zipping data installing help >>> Building/Updating help pages for package 'svcR' Formats: text html latex example chm iris_att texthtmllatex chm iris_mat texthtmllatex chm iris_var texthtmllatex chm svcR texthtmllatex example chm Microsoft HTML Help Compiler 4.74.8702 Compiling c:\DOCUME~1\Nicolas\LOCALS~1\Temp\Rbuild249291931\svcR\chm\svcR.chm Compile time: 0 minutes, 1 second 5 Topics 8 Local links 1 Internet link 1 Graphic Created c:\DOCUME~1\Nicolas\LOCALS~1\Temp\Rbuild249291931\svcR\chm\svcR.chm, 18, 283 bytes Compression increased file by 6,096 bytes. preparing package svcR for lazy loading adding MD5 sums packaged installation of package 'svcR' as svcR_1.0.zip * DONE (svcR) in R environment (Rgui front-end) i write: > install.packages("D:/RBuild/svcR/svcR_1.0.zip", repos=NULL) package 'svcR' successfully unpacked and MD5 sums checked updating HTML package descriptions > library(svcR) Attachement du package : 'svcR' The following object(s) are masked _by_ .GlobalEnv : findModelCluster > and finally when i typewrite my function i obtain : impossible de trouver la fonction "dudi.coa" it can not find the function called in the library that i call in the R source code by library(ade4) if i call my function by source(), it works well thank you for help - Nicolas __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] about integration of a library into package creation
in that sense, it is useless to load the library from R source code making my package which is supposed to include it and load it so if i understand the R philosophy it is not possible to load dll from outside ; the user has to load my package and manually has to load the necessary libraries each time he has to use my library, right ? -- Nicolas Prof Brian Ripley a écrit : > > And also to load the package, maybe with > > rterm R_DEFAULT_PACKAGES=NULL > >> library(svcR) > > > as these messages often indicate missing package dependencies. > >>> * checking package subdirectories ... WARNING >>> Subdirectory 'src' contains no source files. >>> * checking R files for syntax errors ... OK >>> * checking R files for library.dynam ... OK >>> * checking S3 generic/method consistency ... WARNING >>> Erreur : le chargement du package / espace de noms a echoue' pour >>> 'svcR' >>> Sequence d'appel : >>> 2: stop(gettextf("package/namespace load failed for '%s'", >>> libraryPkgName(packag >>> e)), >>>call. = FALSE, domain = NA) >>> 1: library(package, lib.loc = lib.loc, character.only = TRUE, verbose = >>> FALSE) >>> Execution arrete'e >>> See section 'Generic functions and methods' of the 'Writing R >>> Extensions' >>> manual. >>> * checking replacement functions ... WARNING >>> Erreur : le chargement du package / espace de noms a echoue' pour >>> 'svcR' >>> Sequence d'appel : >>> 2: stop(gettextf("package/namespace load failed for '%s'", >>> libraryPkgName(packag >>> e)), >> > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] about integration of a library into package creation
your answer is correct after checking some doc but examples are rare when i write in the description file Depends: R (>= 2.3), quadprog, ade4, spdep and in the namespcae file useDynLib(quadprog) useDynLib(spdep) useDynLib(ade4) importFrom("dist.dudi", "ade4") importFrom("solve.QP", "quadprog") importFrom("mstree", "ade4") importFrom("neig2mat", "ade4") importFrom("dist.dudi", "ade4") importFrom("dudi.pca", "ade4") importFrom("dudi.coa", "ade4") importFrom("knearneigh", "spdep") i obtain : Namespace dependencies not required: dist.dudi dudi.coa dudi.pca knearneigh mstree neig2mat solve.QP if i delete the importFrom lines i get an error about "loading / namespace not succesful" for svcr i think the solution is not far but it is disturbing thank for help --- Nicolas Duncan Murdoch a écrit : > On 6/12/2006 12:25 PM, Nicolas Turenne wrote: > >> in that sense, it is useless to load the library from R source code >> making my package >> which is supposed to include it and load it >> >> so if i understand the R philosophy it is not possible to load dll >> from outside ; >> the user has to load my package and manually has to load the >> necessary libraries >> each time he has to use my library, right ? > > > Not at all. When set up correctly, the user should just need to say > library(svcR) and all necessary packages and DLLs will be loaded. > > The way to specify other packages is through the "Depends" line in the > DESCRIPTION file, and/or the import/importFrom lines in your NAMESPACE > file. > > Duncan Murdoch > >> >> -- >> Nicolas >> >> Prof Brian Ripley a écrit : >> >>> >>> And also to load the package, maybe with >>> >>> rterm R_DEFAULT_PACKAGES=NULL >>> >>>> library(svcR) >>> >>> >>> >>> as these messages often indicate missing package dependencies. >>> >>>>> * checking package subdirectories ... WARNING >>>>> Subdirectory 'src' contains no source files. >>>>> * checking R files for syntax errors ... OK >>>>> * checking R files for library.dynam ... OK >>>>> * checking S3 generic/method consistency ... WARNING >>>>> Erreur : le chargement du package / espace de noms a echoue' pour >>>>> 'svcR' >>>>> Sequence d'appel : >>>>> 2: stop(gettextf("package/namespace load failed for '%s'", >>>>> libraryPkgName(packag >>>>> e)), >>>>>call. = FALSE, domain = NA) >>>>> 1: library(package, lib.loc = lib.loc, character.only = TRUE, >>>>> verbose = >>>>> FALSE) >>>>> Execution arrete'e >>>>> See section 'Generic functions and methods' of the 'Writing R >>>>> Extensions' >>>>> manual. >>>>> * checking replacement functions ... WARNING >>>>> Erreur : le chargement du package / espace de noms a echoue' pour >>>>> 'svcR' >>>>> Sequence d'appel : >>>>> 2: stop(gettextf("package/namespace load failed for '%s'", >>>>> libraryPkgName(packag >>>>> e)), >>>> >>>> >>> >> >> __ >> R-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel > > > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] about integration of a library into package creation
i follow your recommendation writing this : in the description file Depends: R (>= 2.3), quadprog, ade4, spdep Imports: quadprog, ade4, spdep in the namespace file useDynLib(quadprog) useDynLib(spdep) useDynLib(ade4) importFrom("ade4", "dist.dudi") importFrom("quadprog", "solve.QP") importFrom("ade4", "mstree") importFrom("ade4", "neig2mat") importFrom("ade4", "dist.dudi") importFrom("ade4", "dudi.pca") importFrom("ade4", "dudi.coa") importFrom("spdep", "knearneigh") and the result of compiling is : preparing package svcR for lazy loading Erreur dans loadNamespace(ns, lib.loc) : le package 'quadprog' n'a pas d'espace de noms Exécution arrêtée make: *** [lazyload] Error 1 *** Installation of svcR failed *** it says that quadprog has not a namespace perhaps it is due to location of quadprog.dll i have put it into inst/src directory thank for help Nicolas Uwe Ligges a écrit : > Nicolas Turenne wrote: > >> your answer is correct after checking some doc >> but examples are rare >> >> when i write in the description file >> Depends: R (>= 2.3), quadprog, ade4, spdep >> and in the namespcae file >> >> useDynLib(quadprog) >> useDynLib(spdep) >> useDynLib(ade4) >> importFrom("dist.dudi", "ade4") > > > > Please do it the right way (package name first!): > > importFrom("ade4", "dist.dudi") > > Uwe Ligges > > > > >> importFrom("solve.QP", "quadprog") >> importFrom("mstree", "ade4") >> importFrom("neig2mat", "ade4") >> importFrom("dist.dudi", "ade4") >> importFrom("dudi.pca", "ade4") >> importFrom("dudi.coa", "ade4") >> importFrom("knearneigh", "spdep") >> >> i obtain : >> Namespace dependencies not required: >> dist.dudi dudi.coa dudi.pca knearneigh mstree neig2mat solve.QP >> >> if i delete the importFrom lines >> i get an error about "loading / namespace not succesful" for svcr >> >> i think the solution is not far but it is disturbing >> >> thank for help >> >> --- >> Nicolas >> >> >> Duncan Murdoch a écrit : >> >>> On 6/12/2006 12:25 PM, Nicolas Turenne wrote: >>> >>>> in that sense, it is useless to load the library from R source code >>>> making my package >>>> which is supposed to include it and load it >>>> >>>> so if i understand the R philosophy it is not possible to load dll >>>> from outside ; >>>> the user has to load my package and manually has to load the >>>> necessary libraries >>>> each time he has to use my library, right ? >>> >>> >>> Not at all. When set up correctly, the user should just need to say >>> library(svcR) and all necessary packages and DLLs will be loaded. >>> >>> The way to specify other packages is through the "Depends" line in >>> the DESCRIPTION file, and/or the import/importFrom lines in your >>> NAMESPACE file. >>> >>> Duncan Murdoch >>> >>>> -- >>>> Nicolas >>>> >>>> Prof Brian Ripley a écrit : >>>> >>>>> And also to load the package, maybe with >>>>> >>>>> rterm R_DEFAULT_PACKAGES=NULL >>>>> >>>>>> library(svcR) >>>>> >>>>> >>>>> >>>>> as these messages often indicate missing package dependencies. >>>>> >>>>>>> * checking package subdirectories ... WARNING >>>>>>> Subdirectory 'src' contains no source files. >>>>>>> * checking R files for syntax errors ... OK >>>>>>> * checking R files for library.dynam ... OK >>>>>>> * checking S3 generic/method consistency ... WARNING >>>>>>> Erreur : le chargement du package / espace de noms a echoue' >>>>>>> pour 'svcR' >>>>>>> Sequence d'appel : >>>>>>> 2: stop(gettextf("package/namespace load failed for '%s'", >>>>>>> libraryPkgName(packag >>>>>>> e)), >>>>>>>call. = FALSE, domain = NA) >>>>>>> 1: library(package, lib.loc = lib.loc, character.only = TRUE, >>>>>>> verbose = >>>>>>> FALSE) >>>>>>> Execution arrete'e >>>>>>> See section 'Generic functions and methods' of the 'Writing R >>>>>>> Extensions' >>>>>>> manual. >>>>>>> * checking replacement functions ... WARNING >>>>>>> Erreur : le chargement du package / espace de noms a echoue' >>>>>>> pour 'svcR' >>>>>>> Sequence d'appel : >>>>>>> 2: stop(gettextf("package/namespace load failed for '%s'", >>>>>>> libraryPkgName(packag >>>>>>> e)), >>>>>> >>>>>> >>>> __ >>>> R-devel@r-project.org mailing list >>>> https://stat.ethz.ch/mailman/listinfo/r-devel >>> >>> >>> >> >> __ >> R-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel > > > __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] about integration of a library into package creation
it looks strange... if i do only the compiling with the package "spdep" and i avoid useDynLib, it compiles well, but with the package "ade4" and "quadprog" it claims that packages has no namespace Erreur dans loadNamespace(ns, lib.loc) : le package 'quadprog' n'a pas d'espace de noms do you have an explanation ? thank for help --- Nicolas Duncan Murdoch a écrit : > Nicolas Turenne wrote: > >> i follow your recommendation writing this : >> in the description file >> Depends: R (>= 2.3), quadprog, ade4, spdep >> Imports: quadprog, ade4, spdep >> >> in the namespace file >> useDynLib(quadprog) >> useDynLib(spdep) >> useDynLib(ade4) >> importFrom("ade4", "dist.dudi") >> importFrom("quadprog", "solve.QP") >> importFrom("ade4", "mstree") >> importFrom("ade4", "neig2mat") >> importFrom("ade4", "dist.dudi") >> importFrom("ade4", "dudi.pca") >> importFrom("ade4", "dudi.coa") >> importFrom("spdep", "knearneigh") >> > > > I think you are doing too much! > 1. You should not use "useDynLib" for the DLL from another package. > Let the other package load its own DLL. > > 2. If you declare that your package Depends on the other packages, > then they will be loaded and attached, and the importFrom lines will > not be needed. > "Import"ing and "Depend"ing are similar but not identical concepts. > Routines that are imported are available to your package *before* the > global environment (i.e. user workspace). Routines that are in > packages attached by Depends come after the global environment, so > there's a possibility that the user could create a routine named e.g. > "mstree", and your code would use that version, rather than the one > from ade4. So normally "Imports" is better than "Depends". > > However, it appears that you can only import packages that have a > namespace. (I was unaware of this restriction; perhaps it's not > really true, and the error message means something else.) > > So you can probably get rid of the error message by using only > Depends, but you may want to keep the Imports from packages other than > quadprog. > > Duncan Murdoch > >> and the result of compiling is : >> preparing package svcR for lazy loading >> Erreur dans loadNamespace(ns, lib.loc) : le package 'quadprog' n'a >> pas d'espace de noms >> Exécution arrêtée >> make: *** [lazyload] Error 1 >> *** Installation of svcR failed *** >> >> it says that quadprog has not a namespace >> perhaps it is due to location of quadprog.dll >> i have put it into inst/src directory >> >> thank for help >> >> Nicolas >> >> Uwe Ligges a écrit : >> >> >> >>> Nicolas Turenne wrote: >>> >>> >>> >>>> your answer is correct after checking some doc >>>> but examples are rare >>>> >>>> when i write in the description file >>>> Depends: R (>= 2.3), quadprog, ade4, spdep >>>> and in the namespcae file >>>> >>>> useDynLib(quadprog) >>>> useDynLib(spdep) >>>> useDynLib(ade4) >>>> importFrom("dist.dudi", "ade4") >>>> >>> >>> >>> Please do it the right way (package name first!): >>> >>> importFrom("ade4", "dist.dudi") >>> >>> Uwe Ligges >>> >>> >>> >>> >>> >>> >>>> importFrom("solve.QP", "quadprog") >>>> importFrom("mstree", "ade4") >>>> importFrom("neig2mat", "ade4") >>>> importFrom("dist.dudi", "ade4") >>>> importFrom("dudi.pca", "ade4") >>>> importFrom("dudi.coa", "ade4") >>>> importFrom("knearneigh", "spdep") >>>> >>>> i obtain : >>>> Namespace dependencies not required: >>>> dist.dudi dudi.coa dudi.pca knearneigh mstree neig2mat solve.QP >>>> >>>> if i delete the importFrom lines >>>> i get an error about "loading / namespace not succesful" for svcr >>>> >>>> i think the solution is not far but it is disturbing >>>> &g
Re: [Rd] about integration of a library into package creation
it works fine if i avoid importFrom directive thank you very much i have a last question the R source code cannot admit gloval variable ? because i have global variables and i get the following message after loading my package by the command 'library(svcR)': The following object(s) are masked _by_ .GlobalEnv : findModelCluster thank for help -- Nicolas Duncan Murdoch a écrit : > Nicolas Turenne wrote: > >> i follow your recommendation writing this : >> in the description file >> Depends: R (>= 2.3), quadprog, ade4, spdep >> Imports: quadprog, ade4, spdep >> >> in the namespace file >> useDynLib(quadprog) >> useDynLib(spdep) >> useDynLib(ade4) >> importFrom("ade4", "dist.dudi") >> importFrom("quadprog", "solve.QP") >> importFrom("ade4", "mstree") >> importFrom("ade4", "neig2mat") >> importFrom("ade4", "dist.dudi") >> importFrom("ade4", "dudi.pca") >> importFrom("ade4", "dudi.coa") >> importFrom("spdep", "knearneigh") >> > > > I think you are doing too much! > 1. You should not use "useDynLib" for the DLL from another package. > Let the other package load its own DLL. > > 2. If you declare that your package Depends on the other packages, > then they will be loaded and attached, and the importFrom lines will > not be needed. > "Import"ing and "Depend"ing are similar but not identical concepts. > Routines that are imported are available to your package *before* the > global environment (i.e. user workspace). Routines that are in > packages attached by Depends come after the global environment, so > there's a possibility that the user could create a routine named e.g. > "mstree", and your code would use that version, rather than the one > from ade4. So normally "Imports" is better than "Depends". > > However, it appears that you can only import packages that have a > namespace. (I was unaware of this restriction; perhaps it's not > really true, and the error message means something else.) > > So you can probably get rid of the error message by using only > Depends, but you may want to keep the Imports from packages other than > quadprog. > > Duncan Murdoch > >> and the result of compiling is : >> preparing package svcR for lazy loading >> Erreur dans loadNamespace(ns, lib.loc) : le package 'quadprog' n'a >> pas d'espace de noms >> Exécution arrêtée >> make: *** [lazyload] Error 1 >> *** Installation of svcR failed *** >> >> it says that quadprog has not a namespace >> perhaps it is due to location of quadprog.dll >> i have put it into inst/src directory >> >> thank for help >> >> Nicolas >> >> Uwe Ligges a écrit : >> >> >> >>> Nicolas Turenne wrote: >>> >>> >>> >>>> your answer is correct after checking some doc >>>> but examples are rare >>>> >>>> when i write in the description file >>>> Depends: R (>= 2.3), quadprog, ade4, spdep >>>> and in the namespcae file >>>> >>>> useDynLib(quadprog) >>>> useDynLib(spdep) >>>> useDynLib(ade4) >>>> importFrom("dist.dudi", "ade4") >>>> >>> >>> >>> Please do it the right way (package name first!): >>> >>> importFrom("ade4", "dist.dudi") >>> >>> Uwe Ligges >>> >>> >>> >>> >>> >>> >>>> importFrom("solve.QP", "quadprog") >>>> importFrom("mstree", "ade4") >>>> importFrom("neig2mat", "ade4") >>>> importFrom("dist.dudi", "ade4") >>>> importFrom("dudi.pca", "ade4") >>>> importFrom("dudi.coa", "ade4") >>>> importFrom("knearneigh", "spdep") >>>> >>>> i obtain : >>>> Namespace dependencies not required: >>>> dist.dudi dudi.coa dudi.pca knearneigh mstree neig2mat solve.QP >>>> >>>> if i delete the importFrom lines >>>> i get an error about "loading / namespace not succesful" for svcr >>>> >>>> i think the solution is not far but it is disturbing >>>> >>>> thank for
Re: [Rd] about integration of a library into package creation
i solve the problem of masked GlobalEnv which is induced from conflicts with objects in memory removing objects before installing the package solves the warning message Nicolas __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] about integration of a library into package creation
Hello, I dont understand such error coming from my installed package and dont appearing when i load the code source directly . The problem occur when the function capture the path value (FileIn), and so cannot find the file inside the directory. > findModelCluster(MetOpt, MetLab, Nu, q, K=1, G, Cx, Cy, DName="iris", fileIn="D:\\R\\library\\svcR\\data\\"); Erreur dans findModelCluster(MetOpt, MetLab, Nu, q, K = 1, G, Cx, Cy, DName = "iris", : impossible de changer la valeur d'un lien verrouillé (in English: impossible to change the value of a locked link) thank you --- Nicolas __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] problem to read data into a package
Hello i have this following error making a package -- Making package svcR adding build stamp to DESCRIPTION installing NAMESPACE file and metadata installing R files installing data files installing man source files installing indices Error in read.table(zfile, header = TRUE) : more column than column names this kind of error is produced when spaces are met in data . in my case there are only tabulations and three columns of real numbers (with 3 digits) i have no idea what it happens thank for help -- Nicolas __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel