Re: [R] Off topic --- underdispersed (pseudo) binomial data.

2021-03-25 Thread Rolf Turner
On Fri, 26 Mar 2021 13:41:00 +1300 Abby Spurdle wrote: > I haven't checked this, but I guess that the number of students that > *pass* a particular exam/subject, per semester would be like that. > > e.g. > Let's say you have a course in maximum likelihood, that's taught once > per year to 3rd

Re: [R] Off topic --- underdispersed (pseudo) binomial data.

2021-03-25 Thread Abby Spurdle
I haven't checked this, but I guess that the number of students that *pass* a particular exam/subject, per semester would be like that. e.g. Let's say you have a course in maximum likelihood, that's taught once per year to 3rd year students, and a few postgrads. You could count the number of passe

Re: [R] Thanks for help

2021-03-25 Thread Bert Gunter
apply() is also a (disguised) loop, though. I think you will find that indexing via rowSums is a lot faster: ## The example set.seed(111) ## for reproducibility a<-matrix(sample(1:20,350,TRUE),ncol=10) ## 35 rows ## A one-liner a[rowSums(a != 1) == 10, ] ## 20 rows Bert Gunter "The trouble w

Re: [R] Thanks for help

2021-03-25 Thread Jim Lemon
Okay, if I understand this, you want to remove all rows that have, for example, a 1 in any of ten columns: a<-matrix(sample(1:20,350,TRUE),ncol=10) # check it out a # first do it with a loop b<-a for(i in 1:ncol(b)) b<-b[b[,i]!=1,] b # now get tricky and do it in one operation no1s<-apply(a,1,func

Re: [R] How to average minutes per hour per month in the form of '# hours #minutes'

2021-03-25 Thread Jeff Newmiller
This is a very unclear question. Weeks don't line up with months.. so you need to clarify how you would do this or at least give an explicit example of input data and result data. On March 25, 2021 11:34:15 AM PDT, Dr Eberhard W Lisse wrote: >Thanks, that is helpful. > >But, how do I group it t

Re: [R] How to average minutes per hour per month in the form of '# hours #minutes'

2021-03-25 Thread Dr Eberhard W Lisse
Thanks, that is helpful. But, how do I group it to produce hours worked per week per month? el On 2021-03-25 19:03 , Greg Snow wrote: Here is one approach: tmp <- data.frame(min=seq(0,150, by=15)) tmp %>% mutate(hm=sprintf("%2d Hour%s %2d Minutes", min %/% 60, ifelse

Re: [R] How to average minutes per hour per month in the form of '# hours #minutes'

2021-03-25 Thread Greg Snow
Here is one approach: tmp <- data.frame(min=seq(0,150, by=15)) tmp %>% mutate(hm=sprintf("%2d Hour%s %2d Minutes", min %/% 60, ifelse((min %/% 60) == 1, " ", "s"), min %% 60)) You could replace `sprintf` with `str_glue` (and update the syntax as well) if

Re: [R] R-help Digest, Vol 217, Issue 25

2021-03-25 Thread phil
Thank you, Messrs Barradas and Gross, for your very helpful advice. Philip Message: 21 Date: Wed, 24 Mar 2021 22:41:25 -0400 From: "Avi Gross" To: Subject: Re: [R] Including a ggplot call with a conditional geom in a function Message-ID: <07e801d72120$59e5c720$0db15560$@verizon.net>