Skip to content

type_mean_se#571

Open
marcboschmatas wants to merge 7 commits intograntmcdermott:mainfrom
marcboschmatas:main
Open

type_mean_se#571
marcboschmatas wants to merge 7 commits intograntmcdermott:mainfrom
marcboschmatas:main

Conversation

@marcboschmatas
Copy link
Copy Markdown

@marcboschmatas marcboschmatas commented Apr 23, 2026

Some time ago, I opened an issue to see whether it was possible to create a "mean_se" option for type_summary() (#436). You mentioned this was difficult, and I've been working on it for some time. The best solution I could come up with was to make a type_mean_se() (https://github.com/marcboschmatas/tinyplot/blob/main/R/type_mean_se.R). I managed to do one which works well enough, but it has a pretty important problem here, instead of getting the categorical values for X, I get their factor order, so for instance,

plt(bill_length_mm ~ species, data = penguins, type = "mean_se")
returns
imatge

Trying to pass character values to draw_pointrange() will return this error.


Error in segments(x0 = ixmin, y0 = iymin, x1 = ixmax, y1 = iymax, col = icol,  : 
  first argument is not valid
Called from: segments(x0 = ixmin, y0 = iymin, x1 = ixmax, y1 = iymax, col = icol, 
    lwd = ilwd)

EDIT: this has been sorted now, as well as dodging issues, so this code

plt(mpg ~ cyl | gear, data = mtcars, type = type_mean_se(dodge = .1))

Returns this plot
imatge

I don't know if you'd be interested in incorporating this feature. Of course, I'll incorporate formal tests and so on before merging.

Thanks!

DISCLAIMER, I have used Claude AI for some debugging.

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.

2 participants