Glossary of R Functions Ben Kite, Paul Johnson 05/17/2018 CrossTable(): In gmodels package, an SPSS-style cross-tabulation abline(): Add stright line to a plot, many interfaces allowed abline(): Generate a straight line that spans the plot addmargins(): Add marginal sum to a table aes(): In ggplot2, general design of a plot anova(): Compare 2 models, by Chi-square or F test apply(): For matrix input, calculate a value for each row or column as.factor(): Coerce a variable into a factor as.vector(): Coerce an object into a vector attributes(): Ask object for its secrets (class and other "hidden") barplot(): Creates a barplot from a table boxplot(): Create a box plot bquote(): In plotmath, used to combine expression with calculations bquote(): a way to combine text strings and output into an R expression (see plotmath) by(): Run a function for each section of rows (by a categorical var) c(): Concatenate (or column vector) cat(): write an object to screen into file, without beautification class(): Ask an object for its class. Same as checking attributes() coef(): Coefficient extractor, behaves differently for object classes colnames(): Vector of column names from a data.frame combineLevels(): rockchalk package to combine levels in a factor compareCFA(): In kutils, create a table for difference tests confint(): Confidence intervals from an object data.frame(): Create a data frame dev.new(): Create a new on-screen table. dir.create(): Create a directory dir.exists(): Check if directory exists in the OS dlogis(): density of a logistic distribution eval(): calculates the value of a call object (unevaluated expression) exp(): exponential values in the input, as in exp(x) expression(): Treat argument as an R expression, not as char string factor(): Creates a factor variable file.copy(): Copy files or directories file.exists(): Returns true if a file exists fitted(): Ask a regression model for the predicted values for(): Used to create loops frac(): Used in plotmath to create fractions function(): Creates functions genTable(): In memisc, create cross tabulation ggplot(): In ggplot2, this creates a device gray.colors(): Creates a simple color palate of gray grid(): Adds a rectangular display on a plot gsub(): Substitutes characters using GNU regular expressions head(): Show first elements of an object hexbin(): Package to create hexagonal "heat map" hexbinplot(): Renders the hex plot hist(): Generate a Histogram if(): An if logical operator ifelse(): Used for recoding. If input 1 is TRUE, item 2; else 3. influence.measures(): In regression, identify outliers invisible(): Returns a value, but does not run print() on it. jitter(): In plotting, adds small noise to x,y coordinates latex(): Hmisc function for latex markup legend(): Add a legend to a plot length(): Check the number of items in a vector levels(): Ask a factor for its current levels leveneTest(): In car, test for homogeneous variance library(): Interact with the package collection lines(): add lines to a plot list(): Create an R list object lm(): Linear model: regression load(): Import an RData workspace (collection of objects) log(): logarithm, defaults to natural log ls(): list items in workspace max(): maximum, don't forget na.rm=TRUE mean(): Find the mean meanCenter(): In rockchalk, replace predictors with mean-centered equivalents median(): median, don't forget na.rm=TRUE min(): minimum, don't forget na.rm=TRUE model.frame(): Create a data frame necessary to re-estimate a regression model model.matrix(): Extract the design matrix from a regression model mtext(): write margin text into a plot names(): Retrieve the names of items in a list newdata(): In rockchalk, creates a new data.frame suitable for use with predict options(): See or set values of the user session, such as number of digits displayed in output. pairs(): Create a scatterplot matrix par(): Set or query graphical parameters parameterEstimates(): In lavaan, summarize a fitted model parse(): Interpret an expression to create a call (executable statement) paste(): Combine character values into a longer string. Is vectorized, works with vectors paste(x, y). paste0(): Combine character strings, but with no space between items pctable(): In rockchalk, create a column-percentage table pdf(): Create output file "device" that subsequent plot commands will draw into pdf.options(): Used in beginning of script to set defaults percent(): In memisc, can help in creating column percents phantom(): In plotmath, inserts small blank space plot(): Generate a plot plotSlopes(): In rockchalk, plot a regression with interactions points(): Add points to a plot predict(): R generic for calculating fitted values in regression models predictOMatic(): In rockchalk, convenience to create newdata and predictions prop.table(): Creates proportions in a cross tabulation quantile(): Calculate quantiles values (data separator points) range(): a vector with min and max rbinom(): Simulate values from a binomial distribution read.table(): Read a data frame from a text file readRDS(): Read an R serialization file rect(): Draw a rectangle on a plot require(): Loads a package, almost same as library() resid(): Ask a regression for the residuals rgamma(): Simulate values from a gamma distribution ribbon(): In ggplot2, used to draw a shaded area rnorm(): Generate a normal distribution with mean 0 and variance 1 round(): Rounds floating points to integers rowMeans(): For a matrix, efficient way to calculate row means rpois(): Generate simulated poisson random values sapply(): Run lapply, simplify the result. saveRDS(): Creates an rds file (one object) sem(): In sem, run a structural equation model semPaths(): semTable(): In kutils, create an sem table seq(): Create a sequence of values sessionInfo(): Print version information about R sessionInfo(): Print version information about R set.seed(): Initialize the internal random number generator set.seed(): Initialize the internal random number generator setdiff(): Find values in one list that are not in the other sort(): order a vector from small to large sqrt(): Calculate the square root strwidth(): Calculate width needed to write a character string substitute(): R programming method to replace symbolic values (advanced) summarize(): In rockchalk, Hmisc, or plyr packages summary(): R generic to display basic, overall view t.test(): A basic t.test numeric vectors table(): Creates cross-tabulation of 1 or more variables testSlopes(): In rockchalk, creates a J-N display of regression interaction text(): Add text to the plot region theme(): In ggplot2, a style element with(): For a given data frame, run the following instruction