giving priority to stats package

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

giving priority to stats package

Gabor Grothendieck
library and require have new args in 3.6 giving additional control
over conflicts.  This seems very useful but I was wondering if there
were some, preferabley simple, way to give existing loaded packages
priority without knowing the actual conflicts in advance.  For example

    library(dplyr, exclude = c("filter", "lag"))

works to avoid masking those names in stats that would otherwise be
masked by that package but I had to know in advance that filter and
lag were the conflicting names.

--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: giving priority to stats package

glsnow
You could use the `pos` arg to place the newly loaded package(s) on
the search path after the stats package.  That would give priority for
any functions in the stats package over the newly loaded package (but
also give priority for any other packages earlier on the search path).

On Sat, Nov 23, 2019 at 6:25 AM Gabor Grothendieck
<[hidden email]> wrote:

>
> library and require have new args in 3.6 giving additional control
> over conflicts.  This seems very useful but I was wondering if there
> were some, preferabley simple, way to give existing loaded packages
> priority without knowing the actual conflicts in advance.  For example
>
>     library(dplyr, exclude = c("filter", "lag"))
>
> works to avoid masking those names in stats that would otherwise be
> masked by that package but I had to know in advance that filter and
> lag were the conflicting names.
>
> --
> Statistics & Software Consulting
> GKX Group, GKX Associates Inc.
> tel: 1-877-GKX-GROUP
> email: ggrothendieck at gmail.com
>
> ______________________________________________
> [hidden email] 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.



--
Gregory (Greg) L. Snow Ph.D.
[hidden email]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: giving priority to stats package

Gabor Grothendieck
Goold idea.  This seems to work.

  library(dplyr, pos = grep("package:stats", search()) + 1)

On Mon, Nov 25, 2019 at 1:27 PM Greg Snow <[hidden email]> wrote:

>
> You could use the `pos` arg to place the newly loaded package(s) on
> the search path after the stats package.  That would give priority for
> any functions in the stats package over the newly loaded package (but
> also give priority for any other packages earlier on the search path).
>
> On Sat, Nov 23, 2019 at 6:25 AM Gabor Grothendieck
> <[hidden email]> wrote:
> >
> > library and require have new args in 3.6 giving additional control
> > over conflicts.  This seems very useful but I was wondering if there
> > were some, preferabley simple, way to give existing loaded packages
> > priority without knowing the actual conflicts in advance.  For example
> >
> >     library(dplyr, exclude = c("filter", "lag"))
> >
> > works to avoid masking those names in stats that would otherwise be
> > masked by that package but I had to know in advance that filter and
> > lag were the conflicting names.
> >
> > --
> > Statistics & Software Consulting
> > GKX Group, GKX Associates Inc.
> > tel: 1-877-GKX-GROUP
> > email: ggrothendieck at gmail.com
> >
> > ______________________________________________
> > [hidden email] 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.
>
>
>
> --
> Gregory (Greg) L. Snow Ph.D.
> [hidden email]



--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: giving priority to stats package

glsnow
I was thinking of using length(search())+1 to be safe and simple.
Using grep gives higher priority than length while still solving your
issue.

On Mon, Nov 25, 2019 at 3:06 PM Gabor Grothendieck
<[hidden email]> wrote:

>
> Goold idea.  This seems to work.
>
>   library(dplyr, pos = grep("package:stats", search()) + 1)
>
> On Mon, Nov 25, 2019 at 1:27 PM Greg Snow <[hidden email]> wrote:
> >
> > You could use the `pos` arg to place the newly loaded package(s) on
> > the search path after the stats package.  That would give priority for
> > any functions in the stats package over the newly loaded package (but
> > also give priority for any other packages earlier on the search path).
> >
> > On Sat, Nov 23, 2019 at 6:25 AM Gabor Grothendieck
> > <[hidden email]> wrote:
> > >
> > > library and require have new args in 3.6 giving additional control
> > > over conflicts.  This seems very useful but I was wondering if there
> > > were some, preferabley simple, way to give existing loaded packages
> > > priority without knowing the actual conflicts in advance.  For example
> > >
> > >     library(dplyr, exclude = c("filter", "lag"))
> > >
> > > works to avoid masking those names in stats that would otherwise be
> > > masked by that package but I had to know in advance that filter and
> > > lag were the conflicting names.
> > >
> > > --
> > > Statistics & Software Consulting
> > > GKX Group, GKX Associates Inc.
> > > tel: 1-877-GKX-GROUP
> > > email: ggrothendieck at gmail.com
> > >
> > > ______________________________________________
> > > [hidden email] 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.
> >
> >
> >
> > --
> > Gregory (Greg) L. Snow Ph.D.
> > [hidden email]
>
>
>
> --
> Statistics & Software Consulting
> GKX Group, GKX Associates Inc.
> tel: 1-877-GKX-GROUP
> email: ggrothendieck at gmail.com



--
Gregory (Greg) L. Snow Ph.D.
[hidden email]

______________________________________________
[hidden email] 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.