R notes

A vector can only contain objects of the same class. Empty vectors can be created with the vector() function.

Numbers in R are generally treated as double precision real numbers. This means that even if you see a number like “1” or “2” in R, which you might think of as integers, they are likely represented behind the scenes as numeric objects something like “1.00” or “2.00”.

Entering 1 in R gives you a numeric object; entering 1L explicitly gives you an integer object. If you explicitly want an integer, you need to specify the L suffix.

Number Inf represents infinity in R.

Attributes of an object (if any) can be accessed using the attributes() function. Not all R objects contain attributes, in which case the attributes() function returns NULL.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s