# Changelog for MATLAB/R Reference, by David Hiebeler

- Jun 24, 2014:
- Additions:
Mention of the
**pracma**R package which implements many Matlab functions; in particular, this reference refers to the functions**cross**,**circshift**,**fliplr**,**flipud**,**meshgrid**,**null**,**orth**. Matlab equivalent of R's**cummin**,**cummax**functions. Notes about how R's**scan**may behave oddly depending on how code is executed. More efficient way to compute matrix 2-norm in R (thanks to Jian Ye). Executing system commands via Matlab's**!**and R's**system**(thanks to Seungyeon Kim).**summary**(thanks to Berry Boessenkool).**unique**(thanks to Rachel Rier). Matlab**randi**. Matlab**null**and**orth**. Matlab**fix**/ R**trunc**. R**object.size**and Matlab equivalent via**whos**. Matlab**repmat**and R**kronecker**(thanks to Luke Hartigan). R**outer**and Matlab**bsxfun**. R**arrayInd**as equivalent of Matlab's**ind2sub**. bitwise operators. - Updates/corrections:
Use of R's
**barplot**corresponding to Matlab's**bar**. Info about R's**svd**. Random number seeds in Matlab (thanks to Richard Cotton for some of it). Added missing "true" argument to Matlab**randsample**entry for sampling with replacement.**mode**info / finding the most frequent value in a vector. Additional use of R's**sample**when generating various types of random values. How R's**sd**function now works with matrices. Typo in Matlab**fminbnd**item.

- Additions:
Mention of the
- Jul 14, 2011:
Mention of
**rgl**package for rotating 3-D plots in R. Saving/loading the workspace. Random values from general discrete distribution. Matlab**exist**, R**exists**. R's**mode**command. Mode of values in a vector. Median of values in a vector. Matlab**pwd**, R**getwd()**, along with cross-references to R**source**in R entries for corresponding Matlab**which**and**path**and to R**ifelse**in R entry for corresponding Matlab**elseif**(thanks to William Simpson). Alternative R versions of Matlab's**fliplr**,**flipud**, and**ind2sub**(thanks to David Windsemius). Alternative Matlab versions of the "all but element k" or "all but elements j and k" of a vector (thanks to Lee Pang and Roger Jeurissen). Better way to use R's**sample**to generate a random integer between 1 and k (thanks to Juan David Ospina Arango). Use of R**cat**(rather than**print**) to avoid quotes in output (thanks to Rachel Rier). - May 25, 2010:
Matrix determinant and trace; vector dot product and cross product.
R
**dev.copy2pdf**and**dev.copy2eps**. R**options(device='X11')**. R**noquote**(thanks to Rachel Rier). R**typeof**. Changed some of the plot-character examples in R "col, pch, and type arguments" table. Fixed error in Matlab**randsample**usage (thanks to Thomas Clerc). Matlab/R**prod**to compute products with vectors and matrices (thanks to Ben Morin). Matlab**circshift**. Matlab**fliplr**and**flipud**(thanks to Corey Yanofsky). Matlab**meshgrid**. Matlab**beep**, R**alarm()**(thanks to Corey Yanofsky). Fixed error in R**write(...)**usage, and index entries for that item. Skipping lines when reading data from text files. Matching regular expressions in strings, and conditionally executing commands when matches are found (thanks to Robert Bryce). R equivalents for Matlab's**polyfit(x,y,n)**function (thanks to Niels Richard Hansen). - Nov 24, 2009:
Using
**X11.options()**in R to turn off antialiasing when using**dev.new()**to create new figure windows (thanks to Rune Schjellerup Philosof again, and Andy Moody). Inserted a couple of missing "len=" keywords in R**seq**commands. Added a Matlab index entry for**shading**and another entry for**meshgrid**. - Nov 11, 2009:
Matlab
**keyboard**and R**browser()**, Matlab**logspace**, Matlab**v(a:end)**and R**v[a:length(v)]**, Matlab**trapz**and R manual equivalent (thanks to Andreas Handel). R**dev.new()**(thanks to Rune Schjellerup Philosof). Matlab and R reading string values from user (thanks to Thomas Clerc). Matlab**sortrows**and R equivalent**order**(thanks to Michael Kiparsky). R**barplot(table(x))**to plot discrete-valued data, newer versions of Matlab use**RandStream**to set random-number seed, using**get**to access global/base variables from within R functions,**return**keyword is optional as the last line of an R function,**<-**preferred over**=**in R in assignments for compatibility with S-plus, Matlab**break**and**continue**and R**break**and**next**(thanks to Richard Cotton). Fixed typo (missing comma) in R**lsoda**command with passed parameters. Fixed typo (missing curly brackets) in Matlab**ismember**example. How to add text labels to plots. Warning about R**scan()**not using keyboard input when scripts are run via Edit/Execute menu command. All-but-one-element of a vector. Line continuation in R depends on the syntax. Matlab**nchoosek**and R**choose**. Multinomial random value generation and PDFs. Adding arrows to figures. - Mar 3, 2009: Finding the rank of a matrix in R (thanks to Manas
A. Pathak). Entering N-dimensional arrays. More efficient way
to solve Ax=B in R. QR matrix
factorization. Corrected error about how R's sd() function behaves
with matrices. Variances of columns and rows of matrices.
Covariances. Correlation coefficients. Assigning and accessing
variables in the base environment. Data editor (Matlab
**openvar**and R**fix**). - Jan 2, 2009: info about Matlab
**drawnow**and the fact that R lattice graphics functions need to be wrapped in**print()**when called from scripts; added a few more index entries; convolution / polynomial multiplication; finding roots of a polynomial, or of a general univariate function; machine epsilon; last computed value (Matlab**ans**or R**.Last.value**); truncating a vector, or reversing the order of its elements; reshaping a matrix;**cumsum**and**cumprod**for cumulative sums and products; cubic splines; error function; numerical integration / quadrature; functions automatically called upon startup and shutdown; "odesolve" package is deprecated, use "deSolve" now; writing functions which return multiple values. Added many things related to linear algebra / matrices: rank; vector norms and matrix norms; condition number; Hilbert matrices; upper and lower triangular portions of matrices; extracting the diagonal of a matrix and constructing a diagonal matrix; LU and Cholesky factorizations; Schur and singular value decompositions. Thanks to Corey Yanofsky for: substrings of character arrays; extracting a row or column of a matrix from R, and keeping the result as a matrix rather than vector. - Sep 1, 2008: added info about Matlab
**ismember**and R**match**, along with Matlab**strcat**and corresponding use of R**paste**(thanks to David Khabie-Zeitoune). Simplified way to list unique values or bin data using Matlab**hist**, added use of Matlab**get**to obtain list of open figures, Matlab**importdata**as an alternative to**load**, Matlab**fprintf**to display strings without the trailing newline, and Matlab**struct**and R**data.frame**(thanks to Lee Pang). Added info about skipping comments when reading data from files, including Greek letters and symbols in plot axis labels, setting font sizes in figure labels, and sample values from a vector with and without replacement. - Feb 11, 2008: added R's "ifelse" vectorized statement (thanks to Stephen Eglen for suggesting it); added item for querying/setting MATLAB's search path; moved all info about installing and loading R packages into a new item which is now cross-referenced by other items requiring package manipulation.
- Jan 18, 2008: small addition to index; info about rotating 3-D
plots made with
**surf**in MATLAB or**persp**in R. - Jan 17, 2008: corrected typo in building a list of values and counts in a vector of discrete values (currently item #101); thanks to Isaac Michaud for catching it.
- Jan 7, 2008: added table of contents; added reference to
**drawnow**to cellular automata display; minor changes to some index entries. - Jan 6, 2008: additional info about printing to PostScript/PDF in R; and a new item about displaying cellular automata / lattice images during simulations (currently item #192), since in R it takes some effort to avoid bad flickering/flashing.
- Dec 29, 2007: changed references to R to use sans-serif font as seems to be the convention, and further slight additions to the R index.
- Dec 28, 2007: corrected capitalization of MATLAB as per The MathWorks editorial guidelines, and fixed an error in the indices.
- Nov 28, 2007: added cdfs (cumluative distribution functions), and also workarounds for how to compute various pdfs and cdfs in MATLAB without using the Statistics Toolbox.
- Nov 9, 2007: corrected descriptions of some pdfs (probability density functions), and some small improvements to the index.
- Oct 26, 2007: fixed error in current item #67, MATLAB
**eig(A)**. - Oct 15, 2007: corrected typo in squaring a matrix (currently item #64); thanks to Alan Cobo-Lewis for pointing it out.
- Sept 25, 2007: added new section 3.5, describing how to fit polynomials to observed values.