R gotchas

I put together a short list of potential R gotchas: unexpected results which might trip up new R users.

For example, if we have a matrix m,

m[1:2,]

returns a matrix, while

m[1,]

returns a vector, unless one writes

m[1,,drop=FALSE]

Setting aside what the default behavior of functions should be, my point is simply that these are important to be aware of. https://github.com/mikelove/r-gotchas/blob/master/README.md

Advertisements

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