youngsaver / opensdp_equity_report_template

Using Texas STAAR test data files for metrics of equity within a district.
0 stars 5 forks source link

Problem ordering box plots #5

Closed youngsaver closed 6 years ago

youngsaver commented 6 years ago

In the R markdown code, in the chunk "SchoolGaps," I am having a hard time ordering the boxplots for the three lowest performing schools. I want them to order such that the lowest median school is to the left, ascending towards the right. However, either the ordering is off or the boxplots aren't matching to the school codes because schools that are supposed to have lower medians appear to have higher medians in the plot. I've tried various strategies (using reorder or changing between characters and ordered factors), and I'm going to have to work on this some more to resolve.

jknowles commented 6 years ago

Sometimes you have to create a new variable to sort by - I call it sort or tmp_sort that is based on the attribute you want and is a sequential integer, then just reorder based on that.

youngsaver commented 6 years ago

Made the fix. It was actually a problem higher up in the code that made the ordering later in the code go wacky.