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...
by Suf | May 8, 2022 | Programming, R, Tips
Table of Contents Table of contents Example #1: Multiline ggplot2 command Example #2: Sorting Data Frame String Column Descending Order Summary This error commonly occurs when the is an unexpected use of a unary operator (+, -, !) This error can occur if you provide...
by Suf | May 7, 2022 | Programming, R, Tips
This error occurs if you do not provide a vector or a matrix to the barplot() function. You can solve this error by ensuring the values you want to plot are in a vector or a matrix. Alternatively, you can use ggplot2 geom_bar() instead of barplot This tutorial will go...