by Suf | May 7, 2022 | Programming, R, Tips
This error occurs when you attempt to subscript a data frame that contains NA values. You can solve this error by excluding the NA values during the subscript operation, for example: data[data$col1<0 & !is.na(data$col1),]$col2 This tutorial will go through the...
by Suf | May 7, 2022 | Programming, R, Tips
This error occurs you try to set limits on the y-axis using scale_y_continuous() and the y variable is not numeric. This error can happen if you use character or factor type for the y variable in your data. You can solve this error by using numeric values instead of...
by Suf | May 7, 2022 | Programming, R, Tips
This error occurs if you use a numeric variable for the fill, color, and shape aesthetics in ggplot when it expects a factor variable. You can solve this error by using a factor class variable as the grouping variable. You can convert numeric values to factor using...
by Suf | May 7, 2022 | Programming, R, Tips
If you try to aggregate a data frame and do not explicitly define the column to aggregate by, you will raise the error: aggregate.data.frame(as.data.frame(x), …): arguments must have same length. This error typically occurs if you use quotation marks to specify...
by Suf | May 7, 2022 | Programming, R, Tips
This error occurs when you try to specify the fill colours when using ggplot2, but the number of colours is not 1 or different from the total number of plots to fill. To solve this error you can either specify one fill colour argument or ensure the total number of...
by Suf | May 7, 2022 | Programming, R, Tips
This error occurs when trying to fit a linear regression model in R using the lm() function but either the predictor or response variables contain Not a Number (NaN) or infinity (Inf) values. You can solve this error by replacing the NaN and Inf values with NA values,...