by Suf | Jun 21, 2022 | Programming, R, Tips
This error occurs when you try to fit a model, and one or more of the variables is a list instead of a vector. You can solve this error by converting the list to a vector using the unlist() function. For example, x <- list(2, 5, 5, 6, 7, 11, 2, 3, 5) y <- c(4,...
by Suf | May 31, 2022 | Programming, R, Tips
This tutorial will go through adding the regression line equation and R-squared to a plot in R with code examples. Table of contentsWhat is the Regression Equation?What is the R-Squared Value?Example: Using ggpubrCreate DataPlot Data and Add Regression EquationPlot...
by Suf | May 30, 2022 | Programming, R, Tips
This error occurs when you call the rep function to replicate data, but the value you provide to replicate the number is not a positive real number. You can solve this problem by ensuring that the number is a single, positive real number. This tutorial will go through...
by Suf | May 29, 2022 | Programming, R, Tips
The pipe operator, %>%, is a special function available under the magrittr package that allows you to pass the result of one function/argument to the other one in sequence. To use the pipe operator, you need to install and load the magrittr package....
by Suf | May 28, 2022 | Programming, R, Tips
This tutorial will go through how to remove outliers from a boxplot using ggplot2 in R with the help of code examples. Table of contentsExampleRemove Outlier Using outlier.shape=NASummary Example In the following example, we are going to use the iris dataset to create...
by Suf | May 28, 2022 | Programming, R, Tips
The easiest way to place two plots side by side using ggplot2 is to install gridExtra and then use the grid.arrange() function. For example, install.packages(“gridExtra”) grid.arrange(plot1, plot2, ncol=2) This tutorial will go through how to place two...