by Suf | May 8, 2022 | Programming, R, Tips
This error occurs when you try to run chunks of code in an Rmd file like a normal R script. RStudio tries to run the highlighted code as R code, including the markdown parts. You can solve this error by clicking the green play button next to an individual code chunk...
by Suf | May 8, 2022 | Programming, R, Tips
This warning occurs when you try to convert a vector containing non-numeric values to a numeric vector. As this is a warning, you do not need to solve anything. However, you can replace non-numeric values or suppress the warning using suppressWarnings(). This tutorial...
by Suf | May 8, 2022 | Programming, R, Tips
This error occurs when you try to replace a value in a vector with a value of length zero. A value of length zero does not exist is the same as saying the value does not exist. This error typically happens when trying to use the zeroth index of a vector. In R, indexes...
by Suf | May 8, 2022 | Programming, R, Tips
If you try to perform k-means clustering with data containing missing values, NaN or Inf, you will raise the error: in do_one(nmeth) : NA/NaN/Inf in foreign function call (arg1). In R, The K-means algorithm cannot handle data with NA, NaN, or Inf values. By...
by Suf | May 8, 2022 | Programming, R, Tips
This error occurs when you try to sort a list without first using the unlist() function. To solve this error, you must use the unlist() function before calling sort(), for example: sort(unlist(a_list)) This tutorial will go through the error and how to solve it with...
by Suf | May 8, 2022 | Programming, R, Tips
This error occurs if you use the aesthetics function aes() in the incorrect place or without the mapping syntax. You can solve this error either by putting the aes() call inside ggplot2(), for example, ggplot(gapminder,aes(x=continent, y=lifeExp, fill=continent)) or...