rmarkdown error “attempt to use zero-length variable name”

Putting this as an answer for visibility: this happens if you try to run by selecting all in the Rmd and pressing enter like you would with a normal R script. RStudio tries to run this all as R code, including the markdown parts, leading to the errors you saw. You can avoid this by … Read more

Categories R

Longer object length is not a multiple of shorter object length?

Yes, this is something that you should worry about. Check the length of your objects with nrow(). R can auto-replicate objects so that they’re the same length if they differ, which means you might be performing operations on mismatched data. In this case you have an obvious flaw in that your subtracting aggregated data from … Read more

Categories R

Error in plot.window(…) : need finite ‘xlim’ valuescc

What should i do for this error? My code is : And my maindata in excel worksheet is : So what should i do now? How can i solve this error? Error in plot.window(…) : need finite ‘xlim’ values In addition: Warning messages: 1: In min(x) : no non-missing arguments to min; returning Inf 2: … Read more

Categories R

“Error: Mapping should be created with `aes()` or `aes_()`.”

I’m trying to build a simple histogram with ggplot2 package in R. I’m loading my data from a csv file and putting 2 of the columns together in a data frame, like this: sp is recognised as a factor of 23 levels (my number of lines) and cov as 23 numbers. Then, to build the … Read more

Categories R