Skip to content

Conversation

@jg20019
Copy link
Contributor

@jg20019 jg20019 commented Aug 14, 2022

This pull request implements split-stems.

If split-stems is true, then instead instead of use mod 10 to calculate the stems, it uses mod 5.
To calculate the base stem, it divides the stem by 2. For example with a vector #(10 15 16 18) by using mod 5 the stems become 2 3 3 3. When printing the stems it divides by 2 and gets the floor so both 2 and 3 are printed as 1.

Closes #2

@CLAassistant
Copy link

CLAassistant commented Aug 14, 2022

CLA assistant check
All committers have signed the CLA.

@Symbolics
Copy link
Contributor

Thanks! I don't think that's what split stems is supposed to do. What split stems does is split (repeat) a stem if its values are too long. This PR looks like it divides the values of a single stem instead.

@jg20019
Copy link
Contributor Author

jg20019 commented Aug 15, 2022

I think I did it correctly. When I tried it with the data set from the example that you linked, I got the exact same result.

> (defvar numbers #(1 1 3 6 7 7 8 10 12 12 13 18 21 23 23 23 24 25 26 27 28 29 31 31 31 34 36))

> (stem-and-leaf numbers)
0 | 1 1 3 6 7 7 8
1 | 0 2 2 3 8
2 | 1 3 3 3 4 5 6 7 8 9
3 | 1 1 1 4 6  

> (stem-and-leaf numbers :split-stem t)
0 | 1 1 3
0 | 6 7 7 8
1 | 0 2 2 3
1 | 8
2 | 1 3 3 3 4
2 | 5 6 7 8 9
3 | 1 1 1 4
3 | 6

What could I be missing?

@snunez1
Copy link
Contributor

snunez1 commented Aug 16, 2022

You're right, that output is correct. Good work; if I'd known it was only a two line change I might not have asked for help. Thanks.

@snunez1 snunez1 merged commit a31990d into Lisp-Stat:master Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement split stems in stemplots

4 participants