Re: [R] mode or parameters of readBin

2007-09-10 Thread Duncan Murdoch
On 9/10/2007 10:26 AM, Sigbert Klinke wrote:
 Hi,
 
   sapply(formals(readBin), mode)
   con  what n  sizesignedendian
namename numeric logical logicalcall
 
 returns for the mode of size logical. But in the documentation is said 
 that size should be integer. Does anyone know why the mode is logical?

The default value is NA, and the mode of NA is logical.  (It will 
automatically be promoted into another type if included in a vector, 
e.g. c(1:2, NA) promotes it to integer, c(3.14, NA) promotes it to numeric.)

More generally, I'd say reading the man page or the source is a better 
way to find out about the requirements for the arguments of a function.

Duncan Murdoch

__
R-help@stat.math.ethz.ch 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] mode or parameters of readBin

2007-09-10 Thread Thomas Lumley
On Mon, 10 Sep 2007, Sigbert Klinke wrote:

 Hi,

  sapply(formals(readBin), mode)
  con  what n  sizesignedendian
   namename numeric logical logicalcall

 returns for the mode of size logical. But in the documentation is said
 that size should be integer. Does anyone know why the mode is logical?


Because NA is a logical constant.

-thomas

__
R-help@stat.math.ethz.ch 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.