2

 

 

Getting Started: Variables and Basic Computations

 

Performing simple computations is virtually identical in both packages. Commands like y = sqrt(7) and x = sin(y) will work in both R and MATLAB, although what you see on your screen after doing them differs between the two platforms. One difference is that in MATLAB, parentheses are optional when calling a function which needs no arguments. That is, you can enter date (which returns the current date) in MATLAB instead of date() if you like. In R, you must enter date() to call the analagous function.

 

 

2.1 Variable names

Variable names in R can consist of letters, digits, periods, and underscores. R installations in some locales may allow for additional characters, such as accented ...

Get R and MATLAB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.