Matlab vs R

I have been using MATLAB since the early 1990s. Some years later I started using R. MATLAB and R have some things in common, but there are many differences. While learning R I started writing down the differences. Below is a list of some of them.

Matlab vs R function and operator names

Matlab   R
size dim
[...] c, rbind, cbind
permute aperm
error stop
ceil ceiling
linspace seq
: : (but behaves differently)
ones(...) rep(1, ...), matrix(1, ...), array(1, ...)
zeros(...) rep(0, ...), matrix(0, ...), array(0, ...)
~ !
~= !=
logical as.logical
cd getwd, setwd
cell list, as.list
sprintf formatC
eval('...') eval(parse(text = "..."))
reshape(x, s) array(x, s), dim(x) <- s

The following functions have the same names in Matlab and R:

round, floor, all, any, length

Valid XHTML 1.0! Valid CSS! Most recently modified 2008-04-14 21:51:42 +02:00
Peter J. Acklam (pjacklam@online.no)