What’s the difference between facet_wrap() and facet_grid() in ggplot2?

The answer below refers to the case when you have 2 arguments in facet_grid() or facet_wrap(). facet_grid(x ~ y) will display x*y plots even if some plots are empty. Ex: There are 4 distinct cyl and 7 distinct class values. The above displays 4 * 7 = 28 plots, even if some are empty (because some classes do not have corresponding … Read more

Categories R

How to convert a data frame column to numeric type?

Since (still) nobody got check-mark, I assume that you have some practical issue in mind, mostly because you haven’t specified what type of vector you want to convert to numeric. I suggest that you should apply transform function in order to complete your task. Now I’m about to demonstrate certain “conversion anomaly”: Let us have a glance at data.frame … Read more

Categories R

Non-conformable arrays error in code

The problem is that omega in your case is matrix of dimensions 1 * 1. You should convert it to a vector if you wish to multiply t(X) %*% X by a scalar (that is omega) In particular, you’ll have to replace this line: with: everywhere in your code. It happens in two places (once … Read more

Categories R