Re: [R] Issue with Imports in NAMESPACE
On 13-06-25 6:50 AM, Søren Højsgaard wrote: Dear all, In my gRbase package I have up until now Depend-ed on RBGL (from Bioconductor), but good people have convinced me that I should use Import-it instead because I only use few functions from RBGL. In DESCRIPTION I therefore now have Imports: Matrix,RBGL In NAMESPACE I now have importFrom(RBGL, maxClique, is.triangulated, separates) The package compiles without complaints, but I have noticed that if I start a fresh R-session, then maxClique etc. from RBGL is NOT available for interactive use in my session: library(gRbase) maxClique Error: object 'maxClique' not found 1) Is this as it should be? 2) If yes, is there any other way in which maxClique can be imported for interactive use without Depend-ing the whole RBGL package? The importFrom directive effectively makes local copies of those functions in your package (with the usual caveats that copies aren't as inefficient as you might think). If you want to export them, you need to add them to the exports list. Duncan Murdoch __ R-help@r-project.org mailing list 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.
Re: [R] Issue with Imports in NAMESPACE
Dear Duncan, Excellent, thanks! Maybe this is worth a remark in a future version of Writing R Extensions (including that those local copies are not exported again with exportPattern(^[[:alpha:]]+)). Thanks! Søren -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: 25. juni 2013 13:02 To: Søren Højsgaard Cc: R hELP (r-h...@stat.math.ethz.ch) Subject: Re: [R] Issue with Imports in NAMESPACE On 13-06-25 6:50 AM, Søren Højsgaard wrote: Dear all, In my gRbase package I have up until now Depend-ed on RBGL (from Bioconductor), but good people have convinced me that I should use Import-it instead because I only use few functions from RBGL. In DESCRIPTION I therefore now have Imports: Matrix,RBGL In NAMESPACE I now have importFrom(RBGL, maxClique, is.triangulated, separates) The package compiles without complaints, but I have noticed that if I start a fresh R-session, then maxClique etc. from RBGL is NOT available for interactive use in my session: library(gRbase) maxClique Error: object 'maxClique' not found 1) Is this as it should be? 2) If yes, is there any other way in which maxClique can be imported for interactive use without Depend-ing the whole RBGL package? The importFrom directive effectively makes local copies of those functions in your package (with the usual caveats that copies aren't as inefficient as you might think). If you want to export them, you need to add them to the exports list. Duncan Murdoch __ R-help@r-project.org mailing list 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.
Re: [R] Issue with Imports in NAMESPACE
On 13-06-25 7:14 AM, Søren Højsgaard wrote: Dear Duncan, Excellent, thanks! Maybe this is worth a remark in a future version of Writing R Extensions (including that those local copies are not exported again with exportPattern(^[[:alpha:]]+)). It is mentioned that they can be exported. The fact that exportPattern doesn't see them might be a bug. Duncan Thanks! Søren -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: 25. juni 2013 13:02 To: Søren Højsgaard Cc: R hELP (r-h...@stat.math.ethz.ch) Subject: Re: [R] Issue with Imports in NAMESPACE On 13-06-25 6:50 AM, Søren Højsgaard wrote: Dear all, In my gRbase package I have up until now Depend-ed on RBGL (from Bioconductor), but good people have convinced me that I should use Import-it instead because I only use few functions from RBGL. In DESCRIPTION I therefore now have Imports: Matrix,RBGL In NAMESPACE I now have importFrom(RBGL, maxClique, is.triangulated, separates) The package compiles without complaints, but I have noticed that if I start a fresh R-session, then maxClique etc. from RBGL is NOT available for interactive use in my session: library(gRbase) maxClique Error: object 'maxClique' not found 1) Is this as it should be? 2) If yes, is there any other way in which maxClique can be imported for interactive use without Depend-ing the whole RBGL package? The importFrom directive effectively makes local copies of those functions in your package (with the usual caveats that copies aren't as inefficient as you might think). If you want to export them, you need to add them to the exports list. Duncan Murdoch __ R-help@r-project.org mailing list 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.
Re: [R] Issue with Imports in NAMESPACE
On Tue, 25 Jun 2013, Duncan Murdoch wrote: On 13-06-25 7:14 AM, Søren Højsgaard wrote: Dear Duncan, Excellent, thanks! Maybe this is worth a remark in a future version of Writing R Extensions (including that those local copies are not exported again with exportPattern(^[[:alpha:]]+)). It is mentioned that they can be exported. The fact that exportPattern doesn't see them might be a bug. I don't think it's a bug -- including all imports would usually bring in way too much. In general re-exporting is probably not such a great idea since the help system isn't aware of the import/export chain. I don't know if R CMD check complains if you don't provide your own help page; if it doesn't it probably should. I also don't recall if we have a mechanism for such a help page on an import/export to just link to the real page. Best, luke Duncan Thanks! Søren -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: 25. juni 2013 13:02 To: Søren Højsgaard Cc: R hELP (r-h...@stat.math.ethz.ch) Subject: Re: [R] Issue with Imports in NAMESPACE On 13-06-25 6:50 AM, Søren Højsgaard wrote: Dear all, In my gRbase package I have up until now Depend-ed on RBGL (from Bioconductor), but good people have convinced me that I should use Import-it instead because I only use few functions from RBGL. In DESCRIPTION I therefore now have Imports: Matrix,RBGL In NAMESPACE I now have importFrom(RBGL, maxClique, is.triangulated, separates) The package compiles without complaints, but I have noticed that if I start a fresh R-session, then maxClique etc. from RBGL is NOT available for interactive use in my session: library(gRbase) maxClique Error: object 'maxClique' not found 1) Is this as it should be? 2) If yes, is there any other way in which maxClique can be imported for interactive use without Depend-ing the whole RBGL package? The importFrom directive effectively makes local copies of those functions in your package (with the usual caveats that copies aren't as inefficient as you might think). If you want to export them, you need to add them to the exports list. Duncan Murdoch __ R-help@r-project.org mailing list 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. -- Luke Tierney Chair, Statistics and Actuarial Science Ralph E. Wareham Professor of Mathematical Sciences University of Iowa Phone: 319-335-3386 Department of Statistics andFax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: luke-tier...@uiowa.edu Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu__ R-help@r-project.org mailing list 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.
Re: [R] Issue with Imports in NAMESPACE
On 06/25/2013 01:19 PM, Duncan Murdoch wrote: On 13-06-25 7:14 AM, Søren Højsgaard wrote: Dear Duncan, Excellent, thanks! Maybe this is worth a remark in a future version of Writing R Extensions (including that those local copies are not exported again with exportPattern(^[[:alpha:]]+)). It is mentioned that they can be exported. The fact that exportPattern doesn't see them might be a bug. In some ways I would have expected R CMD check to complain that maxClique was not documented, because after all the user can have access to maxClique (after library(gRbase)) but not have access to it's documentation library(PkgA) ## Imports: RBGL; importFrom(RBGL, maxClique); export(maxClique) ?maxClique No documentation for 'maxClique' in specified packages and libraries: you could try '??maxClique' R.version.string [1] R Under development (unstable) (2013-06-25 r63053) Personally, if the intention is to make functionality of RBGL available to the end user (even a small part) then I would have Depends: RBGL. Regardless of whether RBGL appears in the Depends: or Imports: field of the DESCRIPTION, I would have import'ed maxClique into the gRbase name space (so that function resolution occurs correctly within the package, even when gRbase is import'ed into another package). Having two apparent ways of arriving at the same function (gRbase::maxClique, RBGL::maxClique) seems to be inviting confusion. Martin Duncan Thanks! Søren -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: 25. juni 2013 13:02 To: Søren Højsgaard Cc: R hELP (r-h...@stat.math.ethz.ch) Subject: Re: [R] Issue with Imports in NAMESPACE On 13-06-25 6:50 AM, Søren Højsgaard wrote: Dear all, In my gRbase package I have up until now Depend-ed on RBGL (from Bioconductor), but good people have convinced me that I should use Import-it instead because I only use few functions from RBGL. In DESCRIPTION I therefore now have Imports: Matrix,RBGL In NAMESPACE I now have importFrom(RBGL, maxClique, is.triangulated, separates) The package compiles without complaints, but I have noticed that if I start a fresh R-session, then maxClique etc. from RBGL is NOT available for interactive use in my session: library(gRbase) maxClique Error: object 'maxClique' not found 1) Is this as it should be? 2) If yes, is there any other way in which maxClique can be imported for interactive use without Depend-ing the whole RBGL package? The importFrom directive effectively makes local copies of those functions in your package (with the usual caveats that copies aren't as inefficient as you might think). If you want to export them, you need to add them to the exports list. Duncan Murdoch __ R-help@r-project.org mailing list 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. -- Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M1 B861 Phone: (206) 667-2793 __ R-help@r-project.org mailing list 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.
Re: [R] Issue with Imports in NAMESPACE
R CMD check does complain and I had to add \alias{maxClique} in an .Rd file (I did it this way to prevent downstream packages from failing). Regards Søren -Original Message- From: luke-tier...@uiowa.edu [mailto:luke-tier...@uiowa.edu] Sent: 25. juni 2013 15:50 To: Duncan Murdoch Cc: Søren Højsgaard; R hELP (r-h...@stat.math.ethz.ch) Subject: Re: [R] Issue with Imports in NAMESPACE On Tue, 25 Jun 2013, Duncan Murdoch wrote: On 13-06-25 7:14 AM, Søren Højsgaard wrote: Dear Duncan, Excellent, thanks! Maybe this is worth a remark in a future version of Writing R Extensions (including that those local copies are not exported again with exportPattern(^[[:alpha:]]+)). It is mentioned that they can be exported. The fact that exportPattern doesn't see them might be a bug. I don't think it's a bug -- including all imports would usually bring in way too much. In general re-exporting is probably not such a great idea since the help system isn't aware of the import/export chain. I don't know if R CMD check complains if you don't provide your own help page; if it doesn't it probably should. I also don't recall if we have a mechanism for such a help page on an import/export to just link to the real page. Best, luke Duncan Thanks! Søren -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: 25. juni 2013 13:02 To: Søren Højsgaard Cc: R hELP (r-h...@stat.math.ethz.ch) Subject: Re: [R] Issue with Imports in NAMESPACE On 13-06-25 6:50 AM, Søren Højsgaard wrote: Dear all, In my gRbase package I have up until now Depend-ed on RBGL (from Bioconductor), but good people have convinced me that I should use Import-it instead because I only use few functions from RBGL. In DESCRIPTION I therefore now have Imports: Matrix,RBGL In NAMESPACE I now have importFrom(RBGL, maxClique, is.triangulated, separates) The package compiles without complaints, but I have noticed that if I start a fresh R-session, then maxClique etc. from RBGL is NOT available for interactive use in my session: library(gRbase) maxClique Error: object 'maxClique' not found 1) Is this as it should be? 2) If yes, is there any other way in which maxClique can be imported for interactive use without Depend-ing the whole RBGL package? The importFrom directive effectively makes local copies of those functions in your package (with the usual caveats that copies aren't as inefficient as you might think). If you want to export them, you need to add them to the exports list. Duncan Murdoch __ R-help@r-project.org mailing list 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. -- Luke Tierney Chair, Statistics and Actuarial Science Ralph E. Wareham Professor of Mathematical Sciences University of Iowa Phone: 319-335-3386 Department of Statistics andFax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: luke-tier...@uiowa.edu Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu __ R-help@r-project.org mailing list 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.
Re: [R] Issue with Imports in NAMESPACE
On 25/06/2013 14:50, luke-tier...@uiowa.edu wrote: On Tue, 25 Jun 2013, Duncan Murdoch wrote: On 13-06-25 7:14 AM, Søren Højsgaard wrote: Dear Duncan, Excellent, thanks! Maybe this is worth a remark in a future version of Writing R Extensions (including that those local copies are not exported again with exportPattern(^[[:alpha:]]+)). It is mentioned that they can be exported. The fact that exportPattern doesn't see them might be a bug. I don't think it's a bug -- including all imports would usually bring in way too much. Not least as most packages import way too much (they import whole packages unselectively). Namespace scoping helps a lot with code in packages, but not with code in examples and demos. I believe that if you want to use maxClique from RBGL other than in the package's own functions you should either use RBGL::maxclique or put RBGL on the search path: but I don't think gRbase should do it for you. In general re-exporting is probably not such a great idea since the help system isn't aware of the import/export chain. I don't know if R CMD check complains if you don't provide your own help page; if it It does, as Søren found out when he submitted to CRAN. doesn't it probably should. I also don't recall if we have a mechanism for such a help page on an import/export to just link to the real page. We do, the \link[RBGL]{maxClique} form. Best, luke Duncan Thanks! Søren -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: 25. juni 2013 13:02 To: Søren Højsgaard Cc: R hELP (r-h...@stat.math.ethz.ch) Subject: Re: [R] Issue with Imports in NAMESPACE On 13-06-25 6:50 AM, Søren Højsgaard wrote: Dear all, In my gRbase package I have up until now Depend-ed on RBGL (from Bioconductor), but good people have convinced me that I should use Import-it instead because I only use few functions from RBGL. In DESCRIPTION I therefore now have Imports: Matrix,RBGL In NAMESPACE I now have importFrom(RBGL, maxClique, is.triangulated, separates) The package compiles without complaints, but I have noticed that if I start a fresh R-session, then maxClique etc. from RBGL is NOT available for interactive use in my session: library(gRbase) maxClique Error: object 'maxClique' not found 1) Is this as it should be? 2) If yes, is there any other way in which maxClique can be imported for interactive use without Depend-ing the whole RBGL package? The importFrom directive effectively makes local copies of those functions in your package (with the usual caveats that copies aren't as inefficient as you might think). If you want to export them, you need to add them to the exports list. Duncan Murdoch __ R-help@r-project.org mailing list 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 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. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list 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.
Re: [R] Issue with Imports in NAMESPACE
On 25/06/2013 1:03 PM, Duncan Murdoch wrote: On 25/06/2013 7:14 AM, Søren Højsgaard wrote: Dear Duncan, Excellent, thanks! Maybe this is worth a remark in a future version of Writing R Extensions (including that those local copies are not exported again with exportPattern(^[[:alpha:]]+)). Yes, from the followup discussion it's clear that this is desired behaviour, so I'll add that. No I won't: Brian Ripley got there first. Duncan Murdoch Duncan Thanks! Søren -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: 25. juni 2013 13:02 To: Søren Højsgaard Cc: R hELP (r-h...@stat.math.ethz.ch) Subject: Re: [R] Issue with Imports in NAMESPACE On 13-06-25 6:50 AM, Søren Højsgaard wrote: Dear all, In my gRbase package I have up until now Depend-ed on RBGL (from Bioconductor), but good people have convinced me that I should use Import-it instead because I only use few functions from RBGL. In DESCRIPTION I therefore now have Imports: Matrix,RBGL In NAMESPACE I now have importFrom(RBGL, maxClique, is.triangulated, separates) The package compiles without complaints, but I have noticed that if I start a fresh R-session, then maxClique etc. from RBGL is NOT available for interactive use in my session: library(gRbase) maxClique Error: object 'maxClique' not found 1) Is this as it should be? 2) If yes, is there any other way in which maxClique can be imported for interactive use without Depend-ing the whole RBGL package? The importFrom directive effectively makes local copies of those functions in your package (with the usual caveats that copies aren't as inefficient as you might think). If you want to export them, you need to add them to the exports list. Duncan Murdoch __ R-help@r-project.org mailing list 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.
Re: [R] Issue with Imports in NAMESPACE
On 25/06/2013 7:14 AM, Søren Højsgaard wrote: Dear Duncan, Excellent, thanks! Maybe this is worth a remark in a future version of Writing R Extensions (including that those local copies are not exported again with exportPattern(^[[:alpha:]]+)). Yes, from the followup discussion it's clear that this is desired behaviour, so I'll add that. Duncan Thanks! Søren -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: 25. juni 2013 13:02 To: Søren Højsgaard Cc: R hELP (r-h...@stat.math.ethz.ch) Subject: Re: [R] Issue with Imports in NAMESPACE On 13-06-25 6:50 AM, Søren Højsgaard wrote: Dear all, In my gRbase package I have up until now Depend-ed on RBGL (from Bioconductor), but good people have convinced me that I should use Import-it instead because I only use few functions from RBGL. In DESCRIPTION I therefore now have Imports: Matrix,RBGL In NAMESPACE I now have importFrom(RBGL, maxClique, is.triangulated, separates) The package compiles without complaints, but I have noticed that if I start a fresh R-session, then maxClique etc. from RBGL is NOT available for interactive use in my session: library(gRbase) maxClique Error: object 'maxClique' not found 1) Is this as it should be? 2) If yes, is there any other way in which maxClique can be imported for interactive use without Depend-ing the whole RBGL package? The importFrom directive effectively makes local copies of those functions in your package (with the usual caveats that copies aren't as inefficient as you might think). If you want to export them, you need to add them to the exports list. Duncan Murdoch __ R-help@r-project.org mailing list 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.
Re: [R] Issue with Imports in NAMESPACE
By chance is any of this related to what I'll call the 'depends relay' discussed in this SO post? http://stackoverflow.com/a/8638902/633251 (see the 'caveat' to Josh O'Brien's answer, which also links back to another answer by Martin Morgan). This issue has happened to me and the symptoms are exactly as Soren originally reported them on this thread (try to do the 'right' thing but be thwarted). Bryan On Jun 25, 2013, at 1:03 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 25/06/2013 7:14 AM, Søren Højsgaard wrote: Dear Duncan, Excellent, thanks! Maybe this is worth a remark in a future version of Writing R Extensions (including that those local copies are not exported again with exportPattern(^[[:alpha:]]+)). Yes, from the followup discussion it's clear that this is desired behaviour, so I'll add that. Duncan Thanks! Søren -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: 25. juni 2013 13:02 To: Søren Højsgaard Cc: R hELP (r-h...@stat.math.ethz.ch) Subject: Re: [R] Issue with Imports in NAMESPACE On 13-06-25 6:50 AM, Søren Højsgaard wrote: Dear all, In my gRbase package I have up until now Depend-ed on RBGL (from Bioconductor), but good people have convinced me that I should use Import-it instead because I only use few functions from RBGL. In DESCRIPTION I therefore now have Imports: Matrix,RBGL In NAMESPACE I now have importFrom(RBGL, maxClique, is.triangulated, separates) The package compiles without complaints, but I have noticed that if I start a fresh R-session, then maxClique etc. from RBGL is NOT available for interactive use in my session: library(gRbase) maxClique Error: object 'maxClique' not found 1) Is this as it should be? 2) If yes, is there any other way in which maxClique can be imported for interactive use without Depend-ing the whole RBGL package? The importFrom directive effectively makes local copies of those functions in your package (with the usual caveats that copies aren't as inefficient as you might think). If you want to export them, you need to add them to the exports list. Duncan Murdoch __ R-help@r-project.org mailing list 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 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.