Rather than as.double() on line 43, I would suggest using readr::parse_number(). In this case (and most) the result will be the same, but instead of getting a warning about NAs being introduced by coercion, you'll get nicer output that shows what values are being coerced. In this case, it's summary rows for the Min, Max, Mean, etc.
Rather than base::merge(), I'd highly encourage you to use the dplyr variants (left_join(), right_join(), inner_join(), and full_join()). The base function is less explicit. By default it does an inner join, but you have done a full join. Generally, I would not recommend either of these. Most of the time what you want is a left join, where you have a primary dataset that you're adding new columns to. Occasionally you want a full join, but an inner join is rather rare (for the work I do anyway). The problem with having full join as a default is just that it can often make the resulting dataset super messy when it doesn't necessarily need to be.
Line 48 works, but because you're primarily working in the tidyverse, I'd suggest trying to stay there as much as possible. In this case, I think it also makes the code more readable. I would do it like this:
First plot looks great! The only thing I'd mention is that you can left justify the title with plot.title.position = "plot" within your theme, rather than trying to fight with hjust. This will also be impervious to aspect ratios, which hjust is not.
Love the second plot with multiple error bars! Color choices are really nice. Looks great.
For the last plot, the binwidth looks off when I render it on my local. I've attached a screenshot here so you can see what I'm seeing. I've removed one point here because it's cutoff and I'm not sure how many balls there actually are.
Hi all - I actually never opened the plot up in a browser and it's possible that's why the figure got cutoff so after further consideration I'll give you that one point back.
Great job everybody! Here's some feedback.
Rather than
as.double()
on line 43, I would suggest usingreadr::parse_number()
. In this case (and most) the result will be the same, but instead of getting a warning aboutNA
s being introduced by coercion, you'll get nicer output that shows what values are being coerced. In this case, it's summary rows for the Min, Max, Mean, etc.Rather than
base::merge()
, I'd highly encourage you to use the dplyr variants (left_join()
,right_join()
,inner_join()
, andfull_join()
). The base function is less explicit. By default it does an inner join, but you have done a full join. Generally, I would not recommend either of these. Most of the time what you want is a left join, where you have a primary dataset that you're adding new columns to. Occasionally you want a full join, but an inner join is rather rare (for the work I do anyway). The problem with having full join as a default is just that it can often make the resulting dataset super messy when it doesn't necessarily need to be.Line 48 works, but because you're primarily working in the tidyverse, I'd suggest trying to stay there as much as possible. In this case, I think it also makes the code more readable. I would do it like this:
First plot looks great! The only thing I'd mention is that you can left justify the title with
plot.title.position = "plot"
within your theme, rather than trying to fight withhjust
. This will also be impervious to aspect ratios, whichhjust
is not.Love the second plot with multiple error bars! Color choices are really nice. Looks great.
For the last plot, the binwidth looks off when I render it on my local. I've attached a screenshot here so you can see what I'm seeing. I've removed one point here because it's cutoff and I'm not sure how many balls there actually are.
Really nice work overall!
+ 3 for good GitHub collaboration.
32/30