Re: [R] Improvement: function cut

2021-09-17 Thread Bert Gunter
Perhaps you and Andrew should take this discussion off list... Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Sep 17, 2021 at 3:45 PM Leonard Mada via R-he

Re: [R] Improvement: function cut

2021-09-17 Thread Leonard Mada via R-help
The warn should be in cut() => .bincode(). It should be generated whenever a real value (excludes NA or NAN or +/- Inf) is not included in any of the bins. If the user writes a script and doesn't want any warnings: he can select warn = FALSE. But otherwise it would be very helpful to catch

Re: [R] Improvement: function cut

2021-09-17 Thread Leonard Mada via R-help
Why would you want to merge different factors? It makes no sense on real data. Even if some names are the same, the factors are not the same! The only real-data application that springs to mind is censoring (right or left, depending on the choice): but here we have both open and closed interv

Re: [R] Improvement: function cut

2021-09-17 Thread Jeff Newmiller
Re your objection that "the user has to suspect that some values were not included" applies equally to your proposed warn option. There are a lot of ways to introduce NAs... in real projects all analysts should be suspecting this problem. On September 17, 2021 3:01:35 PM PDT, Leonard Mada via R

Re: [R] Improvement: function cut

2021-09-17 Thread Leonard Mada via R-help
Hello Andrew, But "cut" generates factors. In most cases with real data one expects to have also the ends of the interval: the argument "include.lowest" is both ugly and too long. [The test-code on the ftable thread contains this error! I have run through this error a couple of times.] The

Re: [R] Improvement: function cut

2021-09-17 Thread Andrew Simmons
I disagree, I don't really think it's too long or ugly, but if you think it is, you could abbreviate it as 'i'. x <- 0:20 breaks1 <- seq.int(0, 16, 4) breaks2 <- seq.int(0, 20, 4) data.frame( cut(x, breaks1, right = FALSE, i = TRUE), cut(x, breaks2, right = FALSE, i = TRUE), check.nam

Re: [R] Improvement: function cut

2021-09-17 Thread Andrew Simmons
While it is not explicitly mentioned anywhere in the documentation for .bincode, I suspect 'include.lowest = FALSE' is the default to keep the definitions of the bins consistent. For example: x <- 0:20 breaks1 <- seq.int(0, 16, 4) breaks2 <- seq.int(0, 20, 4) cbind( .bincode(x, breaks1, right

Re: [R] Improvement: function cut

2021-09-17 Thread Leonard Mada via R-help
Thank you Andrew. Is there any reason not to make: include.lowest = TRUE the default? Regarding the NA: The user still has to suspect that some values were not included and run that test. Leonard On 9/18/2021 12:53 AM, Andrew Simmons wrote: > Regarding your first point, argument 'include.

Re: [R] Improvement: function cut

2021-09-17 Thread Andrew Simmons
Regarding your first point, argument 'include.lowest' already handles this specific case, see ?.bincode Your second point, maybe it could be helpful, but since both 'cut.default' and '.bincode' return NA if a value isn't within a bin, you could make something like this on your own. Might be worth

[R] Improvement: function cut

2021-09-17 Thread Leonard Mada via R-help
Hello List members, the following improvements would be useful for function cut (and .bincode): 1.) Argument: Include extremes extremes = TRUE if(right == FALSE) {    # include also right for last interval; } else {    # include also left for first interval; } 2.) Argument: warn = TRUE Warn

Re: [R] [R Code] Split long names in format.ftable

2021-09-17 Thread Leonard Mada via R-help
Dear List members, I have uploaded an improved version on Github. The function is now fully functional: - justify: left, right, cent...: TODO centre vs center; - sep: separator when printing; - pos: Top, Bottom; TODO: Middle; see: https://github.com/discoleo/R/blob/master/Stat/Tools.Data. I

Re: [R] calculate power-linear mixed effect model

2021-09-17 Thread Bert Gunter
Note that such info is available at https://www.r-project.org/mail.html (under "Special Interest Groups"). IMHO the posting guide ought to prominently say something about this. Cheers, Bert On Fri, Sep 17, 2021 at 1:10 PM Ana Marija wrote: > > Thank you so much for that info! > > On Fri, Sep 1

Re: [R] calculate power-linear mixed effect model

2021-09-17 Thread Ana Marija
Thank you so much for that info! On Fri, Sep 17, 2021 at 3:06 PM Bert Gunter wrote: > > Wrong list! Post on r-sig-mixed-models, not here. > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in

Re: [R] calculate power-linear mixed effect model

2021-09-17 Thread Bert Gunter
Wrong list! Post on r-sig-mixed-models, not here. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Sep 17, 2021 at 12:22 PM Ana Marija wrote: > > Hi All, >

Re: [R] adding results to plot

2021-09-17 Thread Rui Barradas
Hello, *.test functions in base R return a list of class "htest", with its own print method. The method text.htest for objects of class "htest" below is a hack. I adapted the formating part of the code of print.htest to plot text(). I find it maybe too complicated but it seems to work. Warnin

[R] calculate power-linear mixed effect model

2021-09-17 Thread Ana Marija
Hi All, I plan to identify metabolite levels that differ between individuals with various retinopathy outcomes (DR or noDR). I plan to model metabolite levels using linear mixed models ref as implemented in lmm2met software. The model covariates will include: age, sex, SV1, SV, and disease_conditi