Re: [Rd] Error message library()

2011-10-28 Thread Renaud Gaujoux

BTW: an ever more intuitive solution (IMHO) would be to auto-complete package names 
in library( ... Deepayan?;)  That is non-intrusive and in line with the general use of 
R. (Simon)

This is indeed a long wanted feature and to my surprise it actually already 
exists!!! (seems that Deepayan did not tell anybody about it ;) )
The help page ?completion in the utils package explains how to enable it:

utils::rc.settings(ipck=TRUE)

It simply worked on my Ubuntu box -- and directly went in my .Rprofile :)
Hope this helps.

Renaud

--
Renaud Gaujoux
Computational Biology - University of Cape Town
South Africa

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Error message library()

2011-10-28 Thread Simon Urbanek

On Oct 28, 2011, at 6:49 AM, Renaud Gaujoux wrote:

 BTW: an ever more intuitive solution (IMHO) would be to auto-complete 
 package names in library( ... Deepayan?;)  That is non-intrusive and in line 
 with the general use of R. (Simon)
 
 This is indeed a long wanted feature and to my surprise it actually already 
 exists!!! (seems that Deepayan did not tell anybody about it ;) )
 The help page ?completion in the utils package explains how to enable it:
 
 utils::rc.settings(ipck=TRUE)
 

Oh, well, the fact that it's off by default defeats the purpose, since the 
users that would benefit from it most are unlikely to mess with local 
configuration files...
But thanks for finding it!
Simon



 It simply worked on my Ubuntu box -- and directly went in my .Rprofile :)
 Hope this helps.
 
 Renaud
 
 -- 
 Renaud Gaujoux
 Computational Biology - University of Cape Town
 South Africa
 
 __
 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] Error message library()

2011-10-28 Thread Gabor Grothendieck
On Fri, Oct 28, 2011 at 6:49 AM, Renaud Gaujoux
ren...@mancala.cbio.uct.ac.za wrote:
 BTW: an ever more intuitive solution (IMHO) would be to auto-complete
 package names in library( ... Deepayan?;)  That is non-intrusive and in line
 with the general use of R. (Simon)

 This is indeed a long wanted feature and to my surprise it actually already
 exists!!! (seems that Deepayan did not tell anybody about it ;) )
 The help page ?completion in the utils package explains how to enable it:

 utils::rc.settings(ipck=TRUE)

 It simply worked on my Ubuntu box -- and directly went in my .Rprofile :)
 Hope this helps.


Also in terms of what exists now, on Windows the Packages  Load
Package menu on Rgui provides a gui interface to library() from which
one chooses the package from a list so one can't ask for one that does
not exist.

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

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Error message library()

2011-10-28 Thread David Winsemius


On Oct 28, 2011, at 12:02 PM, Gabor Grothendieck wrote:


On Fri, Oct 28, 2011 at 6:49 AM, Renaud Gaujoux
ren...@mancala.cbio.uct.ac.za wrote:
BTW: an ever more intuitive solution (IMHO) would be to auto- 
complete
package names in library( ... Deepayan?;)  That is non-intrusive  
and in line

with the general use of R. (Simon)

This is indeed a long wanted feature and to my surprise it actually  
already

exists!!! (seems that Deepayan did not tell anybody about it ;) )
The help page ?completion in the utils package explains how to  
enable it:


utils::rc.settings(ipck=TRUE)

It simply worked on my Ubuntu box -- and directly went in  
my .Rprofile :)

Hope this helps.



Also in terms of what exists now, on Windows the Packages  Load
Package menu on Rgui provides a gui interface to library() from which
one chooses the package from a list so one can't ask for one that does
not exist.

On a Mac with R.app the same facility exists which I how I check to  
see if a package is available in one of four forms (mac-binary, mac- 
source, Bioc-binary, Bioc-source).


--
David Winsemius, MD
West Hartford, CT

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Error message library()

2011-10-27 Thread Roebuck,Paul L
On 10/26/11 5:49 AM, Milan Bouchet-Valat nalimi...@club.fr wrote:

 Le mercredi 26 octobre 2011 à 09:46 +, ONKELINX, Thierry a écrit :

 When one tries to load a non-installed package you get the error:

 Error in library(xyz) : there is no package called 'xyz'

 I noticed on several occasions that this puzzles beginners. Therefore
 I suggest to change the error description in:

 Error in library(xyz) : there is no package called 'xyz' installed on
 this machine. Check the name of the package or
 use
install.packages(xyz) to install it.

 Couldn't R even directly ask for installing if it exists on CRAN? Like:
 Error in library(xyz) : package 'xyz' is not installed on this machine.
 Do you want to install it? [Y/n]

I'd agree the message should be reworded, but prompting is overkill
for normal users.

Error in library(xyz) : package 'xyz' is not installed.

Nonetheless, Kevin Wright's function is interesting.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Error message library()

2011-10-27 Thread Gabor Grothendieck
On Wed, Oct 26, 2011 at 5:46 AM, ONKELINX, Thierry
thierry.onkel...@inbo.be wrote:
 Dear all,

 When one tries to load a non-installed package you get the error:

 Error in library(xyz) : there is no package called 'xyz'

 I noticed on several occasions that this puzzles beginners. Therefore I 
 suggest to change the error description in:

 Error in library(xyz) : there is no package called 'xyz' installed on this 
 machine. Check the name of the package or use install.packages(xyz) to 
 install it.

 Best regards,


Perhaps it could report where it looked and couldn't find it:

There is no package called 'xyz' in C:/R/win-library/2.13 and
C:/R/R-2.13.2/library




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

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Error message library()

2011-10-27 Thread Milan Bouchet-Valat
Le jeudi 27 octobre 2011 à 13:45 -0400, Gabor Grothendieck a écrit :
 Perhaps it could report where it looked and couldn't find it:
 
 There is no package called 'xyz' in C:/R/win-library/2.13 and
 C:/R/R-2.13.2/library
I think it would be even more scary for beginners, and advanced users
probably know how to find their library path.


Regards

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Error message library()

2011-10-27 Thread Gabor Grothendieck
On Thu, Oct 27, 2011 at 2:10 PM, Milan Bouchet-Valat nalimi...@club.fr wrote:
 Le jeudi 27 octobre 2011 à 13:45 -0400, Gabor Grothendieck a écrit :
 Perhaps it could report where it looked and couldn't find it:

 There is no package called 'xyz' in C:/R/win-library/2.13 and
 C:/R/R-2.13.2/library
 I think it would be even more scary for beginners, and advanced users
 probably know how to find their library path.


Many beginners are advanced but just don't know R.  Its better to give
them the information they need.  With this they can discover what is
there even without knowing the relevant R commands.

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

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Error message library()

2011-10-27 Thread Timothy Bates
I agree: much nicer to say what went wrong than to say there is no package

And many people will not know what R's paths are.

Why not add in a hint about what to do, like:  try running 
install.packages(xyz) 

t


 ggrothendieck
 Many beginners are advanced but just don't know R.  Its better to give
 them the information they need.  With this they can discover what is
 there even without knowing the relevant R commands.

On Oct 27, 2011, at 7:36 PM, Gabor Grothendieck wrote:
 On Thu, Oct 27, 2011 at 2:10 PM, Milan Bouchet-Valat nalimi...@club.fr 
 wrote:
 Le jeudi 27 octobre 2011 à 13:45 -0400, Gabor Grothendieck a écrit :
 Perhaps it could report where it looked and couldn't find it:
 
 There is no package called 'xyz' in C:/R/win-library/2.13 and
 C:/R/R-2.13.2/library
 I think it would be even more scary for beginners, and advanced users
 probably know how to find their library path.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Error message library()

2011-10-26 Thread ONKELINX, Thierry
Dear all,

When one tries to load a non-installed package you get the error: 

Error in library(xyz) : there is no package called 'xyz'

I noticed on several occasions that this puzzles beginners. Therefore I suggest 
to change the error description in:

Error in library(xyz) : there is no package called 'xyz' installed on this 
machine. Check the name of the package or use install.packages(xyz) to 
install it.

Best regards,

Thierry


ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie  Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium

Research Institute for Nature and Forest
team Biometrics  Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium

tel. + 32 54/436 185
thierry.onkel...@inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more than 
asking him to perform a post-mortem examination: he may be able to say what the 
experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure 
that a reasonable answer can be extracted from a given body of data.
~ John Tukey

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Error message library()

2011-10-26 Thread Milan Bouchet-Valat
Le mercredi 26 octobre 2011 à 09:46 +, ONKELINX, Thierry a écrit :
 Dear all,
 
 When one tries to load a non-installed package you get the error: 
 
 Error in library(xyz) : there is no package called 'xyz'
 
 I noticed on several occasions that this puzzles beginners. Therefore
 I suggest to change the error description in:
 
 Error in library(xyz) : there is no package called 'xyz' installed on
 this machine. Check the name of the package or use
 install.packages(xyz) to install it.
Couldn't R even directly ask for installing if it exists on CRAN? Like:
Error in library(xyz) : package 'xyz' is not installed on this machine.
Do you want to install it? [Y/n]

Regards

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Error message library()

2011-10-26 Thread Simon Urbanek

On Oct 26, 2011, at 6:49 AM, Milan Bouchet-Valat wrote:

 Le mercredi 26 octobre 2011 à 09:46 +, ONKELINX, Thierry a écrit :
 Dear all,
 
 When one tries to load a non-installed package you get the error: 
 
 Error in library(xyz) : there is no package called 'xyz'
 
 I noticed on several occasions that this puzzles beginners. Therefore
 I suggest to change the error description in:
 
 Error in library(xyz) : there is no package called 'xyz' installed on
 this machine. Check the name of the package or use
 install.packages(xyz) to install it.
 Couldn't R even directly ask for installing if it exists on CRAN? Like:
 Error in library(xyz) : package 'xyz' is not installed on this machine.
 Do you want to install it? [Y/n]
 

Please, no! We don't want to enter the realm of the computer assuming it knows 
what you want to do (which is becoming too common nowadays, unfortunately, 
making the interaction more and more annoying). For some users this error 
simply means that they mistyped the package name, so fetching CRAN repos on 
that behalf ranges somewhere between overkill and stupidity. If the user can't 
type install.packages() then I am certainly not confident that the user can use 
R for any reasonable data analysis.

Cheers,
Simon

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Error message library()

2011-10-26 Thread Milan Bouchet-Valat
Le mercredi 26 octobre 2011 à 12:34 -0400, Simon Urbanek a écrit :
 Please, no! We don't want to enter the realm of the computer assuming
 it knows what you want to do (which is becoming too common nowadays,
 unfortunately, making the interaction more and more annoying). For
 some users this error simply means that they mistyped the package
 name, so fetching CRAN repos on that behalf ranges somewhere between
 overkill and stupidity.
If we need to connect to CRAN to do that, I indeed withdraw my
suggestion. I had in mind a feature that's present in Bash in some
recent Linux distributions: when a program doesn't exist on the system,
tell the user in what package it can be found (it also detects typos in
program names).

 If the user can't type install.packages() then I am certainly not
 confident that the user can use R for any reasonable data analysis.
There's certainly some truth in your statement. ;-)

OTOH it seems package authors have tried raising the barrier to a quite
high level, and even when knowing what you do, you can get the package
names wrong. Consider for example :
Snowball, but snow and snowfall
rJava and rJython, but RODBC and RWeka
(not to pick on Kurt at all, there are many other examples, but I'm
mainly using these - great - packages)

Maybe a less controversial improvement would be to ask Did you mean
XXX? if a package with a very similar name is *installed*. That
wouldn't require fetching information from CRAN, and would most of the
time be helpful (people install packages they use).


Regards

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Error message library()

2011-10-26 Thread Simon Urbanek

On Oct 26, 2011, at 1:05 PM, Milan Bouchet-Valat wrote:

 Le mercredi 26 octobre 2011 à 12:34 -0400, Simon Urbanek a écrit :
 Please, no! We don't want to enter the realm of the computer assuming
 it knows what you want to do (which is becoming too common nowadays,
 unfortunately, making the interaction more and more annoying). For
 some users this error simply means that they mistyped the package
 name, so fetching CRAN repos on that behalf ranges somewhere between
 overkill and stupidity.
 If we need to connect to CRAN to do that, I indeed withdraw my
 suggestion. I had in mind a feature that's present in Bash in some
 recent Linux distributions: when a program doesn't exist on the system,
 tell the user in what package it can be found (it also detects typos in
 program names).
 

Yes, and that thing drives me crazy so the first thing I do on Ubuntu is to 
remove it (which is not as easy as it should due to a bug in the bash script as 
it turns out - another story :P). In 99% of cases it's useless since the 
suggestions are based on typos ...


 If the user can't type install.packages() then I am certainly not
 confident that the user can use R for any reasonable data analysis.
 There's certainly some truth in your statement. ;-)
 
 OTOH it seems package authors have tried raising the barrier to a quite
 high level, and even when knowing what you do, you can get the package
 names wrong. Consider for example :
 Snowball, but snow and snowfall
 rJava and rJython, but RODBC and RWeka
 (not to pick on Kurt at all, there are many other examples, but I'm
 mainly using these - great - packages)
 

Well, seeing one of my packages on the list I have to say that there were good 
reasons, albeit they may not be known to the user, especially since the reasons 
may be obsolete by now.


 Maybe a less controversial improvement would be to ask Did you mean
 XXX? if a package with a very similar name is *installed*. That
 wouldn't require fetching information from CRAN, and would most of the
 time be helpful (people install packages they use).
 

Yes, that could be an optional feature -- I do want to stress the *optional* in 
the sentence, though.

BTW: an ever more intuitive solution (IMHO) would be to auto-complete package 
names in library( ... Deepayan? ;) That is non-intrusive and in line with the 
general use of R.

Cheers,
Simon


 
 Regards
 
 

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Error message library()

2011-10-26 Thread Kevin Wright
Thierry,

I agree with you and think that computers _should_ help users.

When R tells me a package does not exist, it is almost never because I
typed an incorrect package name.

Almost always it is because:
(1) I am using an old script with a new version of R and have not yet
installed a package.
(2) I am running a current script on a different machine that does not have
a package installed.
(3) I am copying some code from the web and have not yet installed a
package.

MiKTeX does a nice job of auto-installing packages in a silent manner.
I've tried to imitate that with the function below.  I add this to
.Rprofile.  Then use lib(pkg) to install and attach packages
automatically.  The function is rough and needs improvement, but works
reasonably well.

Kevin


assign(lib,
   function(p=NULL, ...){
 # Why ... ?
 p - substitute(p)
 if(!is.null(p)  !is.character(p))
   p - deparse(substitute(p))
 print(p)
 ip - rownames(installed.packages())
 # Should be more clever here and only install some of 'p'
 if(!(p %in% ip)) install.packages(p)

 require(p, ..., character.only=TRUE)
   }, env=startup)



On Wed, Oct 26, 2011 at 4:46 AM, ONKELINX, Thierry thierry.onkel...@inbo.be
 wrote:

 Dear all,

 When one tries to load a non-installed package you get the error:

 Error in library(xyz) : there is no package called 'xyz'

 I noticed on several occasions that this puzzles beginners. Therefore I
 suggest to change the error description in:

 Error in library(xyz) : there is no package called 'xyz' installed on this
 machine. Check the name of the package or use install.packages(xyz) to
 install it.

 Best regards,

 Thierry


 
 ir. Thierry Onkelinx
 Instituut voor natuur- en bosonderzoek
 team Biometrie  Kwaliteitszorg
 Gaverstraat 4
 9500 Geraardsbergen
 Belgium

 Research Institute for Nature and Forest
 team Biometrics  Quality Assurance
 Gaverstraat 4
 9500 Geraardsbergen
 Belgium

 tel. + 32 54/436 185
 thierry.onkel...@inbo.be
 www.inbo.be

 To call in the statistician after the experiment is done may be no more
 than asking him to perform a post-mortem examination: he may be able to say
 what the experiment died of.
 ~ Sir Ronald Aylmer Fisher

 The plural of anecdote is not data.
 ~ Roger Brinner

 The combination of some data and an aching desire for an answer does not
 ensure that a reasonable answer can be extracted from a given body of data.
 ~ John Tukey

 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel


[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Error message library()

2011-10-26 Thread Hadley Wickham
 Please, no! We don't want to enter the realm of the computer assuming it 
 knows what you want to do (which is becoming too common nowadays, 
 unfortunately, making the interaction more and more annoying). For some users 
 this error simply means that they mistyped the package name, so fetching CRAN 
 repos on that behalf ranges somewhere between overkill and stupidity. If the 
 user can't type install.packages() then I am certainly not confident that the 
 user can use R for any reasonable data analysis.

In that case, maybe a better message should be:

 library(xyz)
Error in library(xyz) : there is no package called 'xyz'.
Are you sure you are smart enough to use R?

;)

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Error message library()

2011-10-26 Thread Simon Urbanek

On Oct 26, 2011, at 4:06 PM, Hadley Wickham wrote:

 Please, no! We don't want to enter the realm of the computer assuming it 
 knows what you want to do (which is becoming too common nowadays, 
 unfortunately, making the interaction more and more annoying). For some 
 users this error simply means that they mistyped the package name, so 
 fetching CRAN repos on that behalf ranges somewhere between overkill and 
 stupidity. If the user can't type install.packages() then I am certainly not 
 confident that the user can use R for any reasonable data analysis.
 
 In that case, maybe a better message should be:
 
 library(xyz)
 Error in library(xyz) : there is no package called 'xyz'.
 Are you sure you are smart enough to use R?
 
 ;)
 

Unfortunately we are in code freeze, so it will only make it into 2.14.0 
patched ... ;)

Cheers,
Simon

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel