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.

@grantmcdermott
Copy link
Copy Markdown
Owner

Thanks @marcboschmatas. It will be a little while before I can evaluate this in detail. But for the moment, I'll just say that what you're proposing here is not too dissimilar for a "coefplot" type that I suggested some time ago. #382

I dropped pursuing it b/c of lukewarm feedback (@vincentarelbundock and @zeileis both had good pushback). Maybe the situation has evolved since then, but I'll let others comment in the interim.

@vincentarelbundock
Copy link
Copy Markdown
Collaborator

Yeah, this is for sure a useful function. However, I'm still not convinced it's a good idea for tinyplot, for the same reasons at the link above. Sorry to not be more positive!

@marcboschmatas
Copy link
Copy Markdown
Author

Hi @grantmcdermott and @vincentarelbundock , I've read through #382 and I can see why it's a bit more complicated than I thought, and I mostly agree with Vincent's line of thought. If you see this going somewhere, we can leave it open, otherwise, I'm OK with closing it, and I'll look for something to help with anything else in tinyplot that needs doing, it's a great package, and I'd realy like to contribute a bit.

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.

4 participants