R Code Library

Here we provide many of the useful pieces of R code we find very handy. We hope you would provide your feedback, and if you like the code, please let us know. If you would like to see some code written or some examples, we would love to help out.

Create Lags – Function that creates n number of lags for a field, and/or n number of moving averages for a field in a dataset

Analyze Linear Models – Function that combines the analysis for Linear Models and tests primary assumptions of normality of residuals, constant variance of residuals and independence of residuals.

Mode Function – Function that generates the mode for a dataset, since R doesn’t provide a pre-built mode function.

PCA_Functions – functions to help produce nice output for PCA object from FactoMineR

Min-Max Function – function to produce min-max normalization of a column

Pop_Prop_Test – function to compare population proportions. Provides the ChiSquared value an the Marascuilo Confidence Intervals and Significance

Fill_quantiles – function to provide a vector with the specified quantiles of a particular column

Sample_PCA – sample code for PCA, doesn’t use the PCA functions above , but they can be integrated for communality and easier display.

Latest News, Insights and Trends in Analytics and Data Science