by Suf | May 13, 2022 | Programming, R, Tips
This tutorial will go through counting the number of missing values or NAs in a data frame in R. Table of contentsExampleGet Airquality DataSolution #1: Use summarySolution #2: Use sum and is.naSolution #3: Use sum and is.na in FunctionSummary Example Let’s look...
by Suf | May 10, 2022 | Programming, R, Tips
This error occurs when you try to create a scatter plot using data frames instead of a pair of vectors. To solve this error, you can extract vectors from columns using a comma when subsetting the data frame or using the $ operator followed by the column names. This...
by Suf | May 9, 2022 | Programming, R, Tips
This error occurs when you try to create a line plot using ggplot2 but the x-variable is non-numeric, for example, factor or character. You can solve this error by using group=1 as an argument in the ggplot() function call, otherwise, you can coerce your x-variable to...
by Suf | May 9, 2022 | Programming, R, Tips
In R, Hamming distance is a type of distance metric for finding how similar two vectors are. If the vectors are equal in length, Hamming distance determines the number of bit positions different between them. We can also describe Hamming distance as the minimum number...
by Suf | May 8, 2022 | Programming, R, Tips
This error typically occurs if you have a string starting with a number or if a hyphen is in the wrong place. To solve this error you can change the string so that it does not start with a number. This tutorial will go through the error in detail and how to solve it...
by Suf | May 8, 2022 | Programming, R, Tips
This error occurs if you try to use rbind to row-bind two data frames with mismatching numbers of columns. We can solve the error by using the bind rows function from the dplyr package. This tutorial will go through how to solve the error with code examples. Table of...