a vector which ith element is the minimum of xi yi

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: and y, or between the columns of x and those of y if they are matrices or data frames cor(x, y) linear correlation between x and y, or correlation matrix if they are matrices or data frames round(x, n) rounds the elements of x to n decimals log(x, base) computes the logarithm of x with base base scale(x) if x is a matrix, centers and reduces the data; to center only use the option center=FALSE, to reduce only scale=FALSE (by default center=TRUE, scale=TRUE) pmin(x,y,...) a vector which ith element is the minimum of x[i], y[i], . . . pmax(x,y,...) id. for the maximum cumsum(x) a vector which ith element is the sum from x[1] to x[i] cumprod(x) id. for the product cummin(x) id. for the minimum cummax(x) id. for the maximum union(x,y), intersect(x,y), setdiff(x,y), setequal(x,y), is.element(el,set) “set” functions Re(x) real part of a complex number Im(x) imaginary part Mod(x) modulus; abs(x) is the same Arg(x) angle in radians of the complex number Conj(x) complex conjugate convolve(x,y) compute the several kinds of convolutions of two sequences fft(x) Fast Fourier Transform of an array mvfft(x) FFT of each column of a matrix filter(x,filter) applies linear filtering to a univariate time series or to each series separately of a multivariate time series Many math functions have a logical parameter na.rm=FALSE to specify missing data (NA) removal. Matrices t(x) transpose diag(x) diagonal %*% matrix multiplication solve(a,b) solves a %*% x = b for x solve(a) matrix inverse of a rowsum(x) sum of rows for a matrix-like object; rowSums(x) is a faster version colsum(x), colSums(x) id. for columns rowMeans(x) fast version of row means colMeans(x) id. for columns Advanced data processing apply(X,INDEX,FUN=) a vector or array or list of values obtained by applying a function FUN to margins (INDEX) of X lapply(X,FUN) apply FUN to each element of the list X tapply(X,INDEX,FUN=) apply FUN to each cell of a ragged array given by X with indexes INDEX by(data,INDEX,FUN) apply FUN to data frame data subsetted by INDEX merge(a,b) merge two data frames by common columns or row names xtabs(a b,data=x) a contingency table from cross-classifying factors aggregate(x,by,FUN) splits the data frame x into subsets, computes summary statistics for each, and returns the result in a convenient form; by is a list of grouping elements, each as long as the variables in x stack(x, ...) transform data available as separate columns in a data frame or list into a single column unstack(x, ...) inverse of stack() reshape(x, ...) reshapes a data frame between ’wide’ format with repeated measurements in separate columns of the same record and ’long’ format with the repeated measurements in separate records; use (direction=”wide”) or (direction=”long”) Strings paste(...) concatenate vectors after converting to character; sep= is the string to separate terms (a single space is the default); collapse= is an optional string to separate “collapsed” results substr(x,start,stop) substrings in a character...
View Full Document

Ask a homework question - tutors are online