Advanced Data Processing Flashcards
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”)