Re: [R] How to avoid a divide by zero issue.

2022-01-25 Thread Jim Lemon
Hi Neha, One sure cure for divide by zero is to omit zeros in the denominator variable. num<-sample(0:10,20,TRUE) denom<-sample(0:10,20,TRUE) zeros<-denom == 0 num[!zeros]/denom[!zeros] If you don't want to lose those data and there are no negative values, you could add a small number to all deno

Re: [R] Constructing confidence interval ellipses with R

2022-01-25 Thread John Fox
Dear Paul, This looks like a version of the question you asked a couple of weeks ago. As I explained then, I'm pretty sure that you want concentration (i.e., data) ellipses and not confidence ellipses, which pertain to parameters (e.g., regression coefficients). Also, the hand-drawn concentra

Re: [R] function problem: multi selection in one argument

2022-01-25 Thread Martin Maechler
> Rui Barradas > on Tue, 25 Jan 2022 14:22:47 + writes: > Hello, > Here are 3 functions that do what the question asks for. The first 2 are > tidyverse solutions, the last one a base R function. > I don't understand why the group_by and mutate, that's why I've in

Re: [R] function problem: multi selection in one argument

2022-01-25 Thread Rui Barradas
Hello, Here are 3 functions that do what the question asks for. The first 2 are tidyverse solutions, the last one a base R function. I don't understand why the group_by and mutate, that's why I've included a 2nd tidyverse function. And the base R function follows the same lines of outputing

Re: [R] function problem: multi selection in one argument

2022-01-25 Thread PIKAL Petr
Hallo You should explain better what do you want as many people here do not use tidyverse functions. I am not sure what the function should do. table(iris$Species) give the same result and whatever you do in tidyverse part it always finalise in table(...$Species) Cheers Petr > -Original M