UBC-DSCI / introduction-to-datascience

Open Source Textbook for DSCI100: Introduction to Data Science in R
https://datasciencebook.ca/
Other
50 stars 54 forks source link

Avoid direct legend editing #462

Closed trevorcampbell closed 1 year ago

trevorcampbell commented 1 year ago

In the Python version of the book, we just remap the values "B" and "M" to "Benign" and "Malignant" in the classification analysis, which then avoids us having to muck with legend labels

Joel's comment:

I think it is fragile to overwrite the data values in the legend and would not recommend anyone to do this. What if the order of the data changes, either because new data is added or we do some filtering? Then we might be mistakenly labeling B as Malign and there would be no easy way to find out. I think it is much better to change the values of the individual data points using dictionary like assignment that is robust to data reordering and therefore more reproducible.