Skip to content
Prev 359948 / 398503 Next

[FORGED] Re: identical() versus sapply()

On 09/04/2016 6:27 AM, Rolf Turner wrote:
It's not the fact that one is a vector, it's just that the : function 
returns an integer result when given whole number arguments.  The 
literal 1 is stored in floating point, the result of 1:2 is integer.

I think the rationale is that sequences of whole numbers are often used 
as integers (e.g. in "for (i in 1:2)", whereas constants are often used 
in floating point expressions, so this reduces the number of conversions 
that are needed.  If you really mean your 1 to be stored as an integer, 
write it as 1L.  If you want it as floating point, write it as 1.

Duncan Murdoch

Thread (30 messages)

Paulson, Ariel identical() versus sapply() Apr 8 Jeff Newmiller identical() versus sapply() Apr 8 Rolf Turner identical() versus sapply() Apr 9 Duncan Murdoch identical() versus sapply() Apr 9 Paulson, Ariel identical() versus sapply() Apr 11 Bert Gunter identical() versus sapply() Apr 11 Jeff Newmiller identical() versus sapply() Apr 11 Paulson, Ariel identical() versus sapply() Apr 11 William Dunlap identical() versus sapply() Apr 11 Duncan Murdoch identical() versus sapply() Apr 11 Paulson, Ariel identical() versus sapply() Apr 11 Paulson, Ariel identical() versus sapply() Apr 11 Bert Gunter identical() versus sapply() Apr 11 Duncan Murdoch identical() versus sapply() Apr 11 Rolf Turner identical() versus sapply() Apr 11 Rolf Turner identical() versus sapply() Apr 11 John Kane identical() versus sapply() Apr 12 John Kane identical() versus sapply() Apr 12 Duncan Murdoch identical() versus sapply() Apr 12 John C Nash Documentation: Was -- identical() versus sapply() Apr 12 Michael Dewey identical() versus sapply() Apr 12 Duncan Murdoch Documentation: Was -- identical() versus sapply() Apr 12 Bert Gunter Documentation: Was -- identical() versus sapply() Apr 12 John C Nash Documentation: Was -- identical() versus sapply() Apr 12 Sarah Goslee Documentation: Was -- identical() versus sapply() Apr 12 David Winsemius Documentation: Was -- identical() versus sapply() Apr 12 Duncan Murdoch Documentation: Was -- identical() versus sapply() Apr 12 Duncan Murdoch Documentation: Was -- identical() versus sapply() Apr 12 William Michels Documentation: Was -- identical() versus sapply() Apr 12 John C Nash Documentation: Was -- identical() versus sapply() Apr 12