Another gotcha:

1:2 produces integers, but c(1, 2) produces doubles. They're not equal, but they're printed the same.


@basepair @data_science Yes. It's confusing to people who know C or Java, where that would indicate a long int.

Other than using things like "identical", is there any way to tell ints from doubles in R? Do their behaviors ever differ?

@peterdrake @data_science

This is because they are different functions to the same result!

The first is ':'(1, 2) and the other is c(1, 2). Note that you may use certain functions in this way, with the quotes! I may be rusty, so look into it if it interests you!

Cool difference of result though!

@peterdrake There is a book named The R Inferno, wrote by Patrick Burns, I don't know if you ever heard about it. Maybe you would be interested.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.