Thanks for the reply. What I meant was that there is no int(), if you do a ?readBin, you will find it there. On Friday, September 2, 2016 6:31 AM, Jim Lemon <drjimlemon at gmail.com> wrote: Hi Yucheng, Have a look at "An Introduction to R" (get there with "help.start()"), section : 3.1 Intrinsic attributes: mode and length The distinction between numeric and integer modes in R may not be obvious, but it is important at times. Jim On Fri, Sep 2, 2016 at 5:47 AM, Yucheng Song via R-help <r-help at r-project.org> wrote:> Hi,? In the help or readBin, there is an "int", but actually there is no int(), do you mean some other types?? In fact, numeric() is kind of misleading, what does it mean? > what Either an object whose mode will give the mode of the vector to be read, or a character vector of length one describing the mode: one of "numeric", "double", "integer", "int", "logical", "complex", "character", "raw". >? ? ? ? [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org 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.[[alternative HTML version deleted]]
> On 03 Sep 2016, at 03:24 , Yucheng Song via R-help <r-help at r-project.org> wrote: > > Thanks for the reply. What I meant was that there is no int(), if you do a ?readBin, you will find it there.Not as far as I can tell: what: Either an object whose mode will give the mode of the vector to be read, or a character vector of length one describing the mode: one of ?"numeric"?, ?"double"?, ?"integer"?, ?"int"?, ?"logical"?, ?"complex"?, ?"character"?, ?"raw"?. Note: Either...or... I.e., you can use a character string (==vector of length one) readBin(zz, "int", 8, size = 1) and you can use an object of the desired mode readBin(zz, integer(), ...) or equivalently readBin(zz, 0L, ...) but there is no implication that each of the possible character strings have a corresponding function. It is not clear why we allow both "int" and "integer" here, but there is no reason to expect int() to exist. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
On 03/09/2016 3:56 AM, peter dalgaard wrote:> >> On 03 Sep 2016, at 03:24 , Yucheng Song via R-help <r-help at r-project.org> wrote: >> >> Thanks for the reply. What I meant was that there is no int(), if you do a ?readBin, you will find it there. > > Not as far as I can tell: > > what: Either an object whose mode will give the mode of the vector > to be read, or a character vector of length one describing > the mode: one of ?"numeric"?, ?"double"?, ?"integer"?, > ?"int"?, ?"logical"?, ?"complex"?, ?"character"?, ?"raw"?. > > Note: Either...or... > > I.e., you can use a character string (==vector of length one) > > readBin(zz, "int", 8, size = 1) > > and you can use an object of the desired mode > > readBin(zz, integer(), ...) or equivalently readBin(zz, 0L, ...) > > but there is no implication that each of the possible character strings have a corresponding function.> It is not clear why we allow both "int" and "integer" here, but there is no reason to expect int() to exist.Partial matching isn't allowed on the names (because a length one character vector implies 'what = "character"' unless it happens to contain one of those strings), so this is a way to allow a common readable abbreviation. Duncan Murdoch