Hi
I have issues with an R package developed in 2004.
It works perfectly in R < 3.
It can be installed in R > 3 but functions are not available.
Documentation I found is not really helpful for me who are not an R master.
I have already fixed some problems with R CMD check but remaining ones
are less trivial.
For what I understand - with R < 3 - everything is loaded with this
command in an R file in the R/ directory:
.First.lib <- function(lib, pkg) library.dynam("jacop", pkg, lib);
require("cluster")
Now I replaced that with
.onLoad <- function(lib, pkg) {library.dynam("jacop", pkg, lib);
require("cluster")}
but functions are not found when called.
NAMESPACE exists but is empty.
Any idea how to solve that?
Regards
--
S?bastien Moretti
[R-pkg-devel] Namespace problem with pre-R 3.0.0 package
10 messages · Luke Tierney, Uwe Ligges, Martyn Plummer +2 more
I have just found that R 2 filled by itself the NAMESPACE file with
# Export all names
exportPattern(".")
# Import all packages listed as Imports or Depends
import(
cluster
)
So I filled the NAMESPACE file with that and gave it to R 3
Now functions are found!
Is it enough to do that?
Is it good practice to do that?
is .onLoad ... still required?
Regards
Hi
I have issues with an R package developed in 2004.
It works perfectly in R < 3.
It can be installed in R > 3 but functions are not available.
Documentation I found is not really helpful for me who are not an R master.
I have already fixed some problems with R CMD check but remaining ones
are less trivial.
For what I understand - with R < 3 - everything is loaded with this
command in an R file in the R/ directory:
.First.lib <- function(lib, pkg) library.dynam("jacop", pkg, lib);
require("cluster")
Now I replaced that with
.onLoad <- function(lib, pkg) {library.dynam("jacop", pkg, lib);
require("cluster")}
but functions are not found when called.
NAMESPACE exists but is empty.
Any idea how to solve that?
Regards
--
S?bastien Moretti
On Thu, 2016-03-03 at 15:45 +0100, Sebastien Moretti wrote:
I have just found that R 2 filled by itself the NAMESPACE file with
# Export all names
exportPattern(".")
# Import all packages listed as Imports or Depends
import(
???cluster
)
So I filled the NAMESPACE file with that and gave it to R 3
Now functions are found!
Is it enough to do that?
Yes. Even in the latest version of R, "R CMD build" will create a default NAMESPACE file like that for you if one does not exist. ?
Is it good practice to do that?
No. The Writing R Extensions manual says "such broad patterns are not recommended for production code: it is better to list all exports or use narrowly-defined groups"
is .onLoad ... still required?
Yes, if your package has compiled code (e.g. C, C++, Fortran) then the .onLoad function is required to load it into R. Martyn ?
Regards
Hi
I have issues with an R package developed in 2004.
It works perfectly in R < 3.
It can be installed in R > 3 but functions are not available.
Documentation I found is not really helpful for me who are not an R
master.
I have already fixed some problems with R CMD check but remaining
ones
are less trivial.
For what I understand - with R < 3 - everything is loaded with this
command in an R file in the R/ directory:
.First.lib <- function(lib, pkg) library.dynam("jacop", pkg, lib);
require("cluster")
Now I replaced that with
.onLoad <- function(lib, pkg) {library.dynam("jacop", pkg, lib);
require("cluster")}
but functions are not found when called.
NAMESPACE exists but is empty.
Any idea how to solve that?
Regards
--
S?bastien Moretti
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel-----------------------------------------------------------------------
This message and its attachments are strictly confidenti...{{dropped:8}}
On Thu, 3 Mar 2016, Martyn Plummer wrote:
On Thu, 2016-03-03 at 15:45 +0100, Sebastien Moretti wrote:
I have just found that R 2 filled by itself the NAMESPACE file with
# Export all names
exportPattern(".")
# Import all packages listed as Imports or Depends
import(
???cluster
)
So I filled the NAMESPACE file with that and gave it to R 3
Now functions are found!
Is it enough to do that?
Yes. Even in the latest version of R, "R CMD build" will create a default NAMESPACE file like that for you if one does not exist. ?
Is it good practice to do that?
No. The Writing R Extensions manual says "such broad patterns are not recommended for production code: it is better to list all exports or use narrowly-defined groups"
is .onLoad ... still required?
Yes, if your package has compiled code (e.g. C, C++, Fortran) then the .onLoad function is required to load it into R.
Actually you do not need .onLoad if you use the useDynLib directive in the NAMESPACE file; details are in teh extensions manual at https://cran.r-project.org/doc/manuals/r-release/R-exts.html#useDynLib Best, luke
Martyn ?
Regards
Hi
I have issues with an R package developed in 2004.
It works perfectly in R < 3.
It can be installed in R > 3 but functions are not available.
Documentation I found is not really helpful for me who are not an R
master.
I have already fixed some problems with R CMD check but remaining
ones
are less trivial.
For what I understand - with R < 3 - everything is loaded with this
command in an R file in the R/ directory:
.First.lib <- function(lib, pkg) library.dynam("jacop", pkg, lib);
require("cluster")
Now I replaced that with
.onLoad <- function(lib, pkg) {library.dynam("jacop", pkg, lib);
require("cluster")}
but functions are not found when called.
NAMESPACE exists but is empty.
Any idea how to solve that?
Regards
--
S?bastien Moretti
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel-----------------------------------------------------------------------
This message and its attachments are strictly confidenti...{{dropped:8}}
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa Phone: 319-335-3386
Department of Statistics and Fax: 319-335-3017
Actuarial Science
241 Schaeffer Hall email: luke-tierney at uiowa.edu
Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu
On 03.03.2016 16:08, Martyn Plummer wrote:
On Thu, 2016-03-03 at 15:45 +0100, Sebastien Moretti wrote:
I have just found that R 2 filled by itself the NAMESPACE file with
# Export all names
exportPattern(".")
# Import all packages listed as Imports or Depends
import(
cluster
)
So I filled the NAMESPACE file with that and gave it to R 3
Now functions are found!
Is it enough to do that?
Yes. Even in the latest version of R, "R CMD build" will create a default NAMESPACE file like that for you if one does not exist.
Is it good practice to do that?
No. The Writing R Extensions manual says "such broad patterns are not recommended for production code: it is better to list all exports or use narrowly-defined groups"
is .onLoad ... still required?
Yes, if your package has compiled code (e.g. C, C++, Fortran) then the .onLoad function is required to load it into R.
Well, I do not use .onLoad but just the useDynLib(packagename) directive in the NAESPACE file. Best, Uwe Ligges
Martyn
Regards
Hi
I have issues with an R package developed in 2004.
It works perfectly in R < 3.
It can be installed in R > 3 but functions are not available.
Documentation I found is not really helpful for me who are not an R
master.
I have already fixed some problems with R CMD check but remaining
ones
are less trivial.
For what I understand - with R < 3 - everything is loaded with this
command in an R file in the R/ directory:
.First.lib <- function(lib, pkg) library.dynam("jacop", pkg, lib);
require("cluster")
Now I replaced that with
.onLoad <- function(lib, pkg) {library.dynam("jacop", pkg, lib);
require("cluster")}
but functions are not found when called.
NAMESPACE exists but is empty.
Any idea how to solve that?
Regards
--
S?bastien Moretti
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel-----------------------------------------------------------------------
This message and its attachments are strictly confidenti...{{dropped:8}}
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
On Thu, 2016-03-03 at 16:42 +0100, Uwe Ligges wrote:
On 03.03.2016 16:08, Martyn Plummer wrote:
On Thu, 2016-03-03 at 15:45 +0100, Sebastien Moretti wrote:
I have just found that R 2 filled by itself the NAMESPACE file
with
# Export all names
exportPattern(".")
# Import all packages listed as Imports or Depends
import(
????cluster
)
So I filled the NAMESPACE file with that and gave it to R 3
Now functions are found!
Is it enough to do that?
Yes. Even in the latest version of R, "R CMD build" will create a default NAMESPACE file like that for you if one does not exist.
Is it good practice to do that?
No. The Writing R Extensions manual says "such broad patterns are not recommended for production code: it is better to list all exports or use narrowly-defined groups"
is .onLoad ... still required?
Yes, if your package has compiled code (e.g. C, C++, Fortran) then the .onLoad function is required to load it into R.
Well, I do not use .onLoad but just the useDynLib(packagename) directive in the NAESPACE file.
I stand corrected. Twice. Martyn
Best, Uwe Ligges
Martyn
Regards
Hi
I have issues with an R package developed in 2004.
It works perfectly in R < 3.
It can be installed in R > 3 but functions are not available.
Documentation I found is not really helpful for me who are not
an R
master.
I have already fixed some problems with R CMD check but
remaining
ones
are less trivial.
For what I understand - with R < 3 - everything is loaded with
this
command in an R file in the R/ directory:
.First.lib <- function(lib, pkg) library.dynam("jacop", pkg,
lib);
require("cluster")
Now I replaced that with
.onLoad <- function(lib, pkg) {library.dynam("jacop", pkg,
lib);
require("cluster")}
but functions are not found when called.
NAMESPACE exists but is empty.
Any idea how to solve that?
Regards
--
S?bastien Moretti
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel------------ -----------------------------------------------------------
This message and its attachments are strictly
confidenti...{{dropped:8}}
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel -----------------------------------------------------------------------
This message and its attachments are strictly confidenti...{{dropped:8}}
I have just found that R 2 filled by itself the NAMESPACE file with
# Export all names
exportPattern(".")
# Import all packages listed as Imports or Depends
import(
cluster
)
So I filled the NAMESPACE file with that and gave it to R 3
Now functions are found!
Is it enough to do that?
Yes. Even in the latest version of R, "R CMD build" will create a default NAMESPACE file like that for you if one does not exist.
The package contained an empty NAMESPACE file. That's maybe why it failed.
Is it good practice to do that?
No. The Writing R Extensions manual says "such broad patterns are not recommended for production code: it is better to list all exports or use narrowly-defined groups"
Will export only required functions once identified. Functions are available now! Thanks Will compare results with R 2 and 3 to see if I did not break something.
is .onLoad ... still required?
Yes, if your package has compiled code (e.g. C, C++, Fortran) then the .onLoad function is required to load it into R. Martyn
Regards
Hi
I have issues with an R package developed in 2004.
It works perfectly in R < 3.
It can be installed in R > 3 but functions are not available.
Documentation I found is not really helpful for me who are not an R
master.
I have already fixed some problems with R CMD check but remaining
ones
are less trivial.
For what I understand - with R < 3 - everything is loaded with this
command in an R file in the R/ directory:
.First.lib <- function(lib, pkg) library.dynam("jacop", pkg, lib);
require("cluster")
Now I replaced that with
.onLoad <- function(lib, pkg) {library.dynam("jacop", pkg, lib);
require("cluster")}
but functions are not found when called.
NAMESPACE exists but is empty.
Any idea how to solve that?
Regards
-- S?bastien Moretti
I have just found that R 2 filled by itself the NAMESPACE file with
# Export all names
exportPattern(".")
# Import all packages listed as Imports or Depends
import(
cluster
)
So I filled the NAMESPACE file with that and gave it to R 3
Now functions are found!
Is it enough to do that?
Yes. Even in the latest version of R, "R CMD build" will create a default NAMESPACE file like that for you if one does not exist.
Is it good practice to do that?
No. The Writing R Extensions manual says "such broad patterns are not recommended for production code: it is better to list all exports or use narrowly-defined groups"
is .onLoad ... still required?
Yes, if your package has compiled code (e.g. C, C++, Fortran) then the .onLoad function is required to load it into R.
Well, I do not use .onLoad but just the useDynLib(packagename) directive in the NAESPACE file.
Much simpler like that and I can remove the zzz.R file with .onLoad ... Thanks again Is useDynLib enough for package with compiled code?
Best, Uwe Ligges
Martyn
Regards
Hi
I have issues with an R package developed in 2004.
It works perfectly in R < 3.
It can be installed in R > 3 but functions are not available.
Documentation I found is not really helpful for me who are not an R
master.
I have already fixed some problems with R CMD check but remaining
ones
are less trivial.
For what I understand - with R < 3 - everything is loaded with this
command in an R file in the R/ directory:
.First.lib <- function(lib, pkg) library.dynam("jacop", pkg, lib);
require("cluster")
Now I replaced that with
.onLoad <- function(lib, pkg) {library.dynam("jacop", pkg, lib);
require("cluster")}
but functions are not found when called.
NAMESPACE exists but is empty.
Any idea how to solve that?
Regards
-- S?bastien Moretti
On 4 March 2016 at 08:51, Sebastien Moretti wrote:
| Is useDynLib enough for package with compiled code? For the loading of the shared library, yes. Your other importing and exporting of R functions is orthogonal to this. Dirk
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
Great! Thanks for your explanation Le 04/03/2016 17:55, Dirk Eddelbuettel a ?crit :
On 4 March 2016 at 08:51, Sebastien Moretti wrote: | Is useDynLib enough for package with compiled code? For the loading of the shared library, yes. Your other importing and exporting of R functions is orthogonal to this. Dirk
-- S?bastien Moretti