[R] mode or parameters of readBin

Duncan Murdoch murdoch at stats.uwo.ca
Mon Sep 10 16:49:55 CEST 2007


On 9/10/2007 10:26 AM, Sigbert Klinke wrote:
> Hi,
> 
>  > sapply(formals("readBin"), mode)
>       con      what         n      size    signed    endian
>    "name"    "name" "numeric" "logical" "logical"    "call"
> 
> 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



More information about the R-help mailing list