[R] Help with R coding

Bill Poling B|||@Po||ng @end|ng |rom ze||@@com
Wed May 22 15:53:50 CEST 2019

Thank you Rui, but that is getting me the overall mean not the mean of just the observations that are flagged as TRUE Grouped By the HCPCSCode
 (AllowByLimitFlag == TRUE).

I also tried adding it to the filter you suggested but that does not seem to work either?

tmp1 <- tmp %>%
  group_by(HCPCSCode) %>%
  filter(AllowByLimitFlag==TRUE) %>%
  summarise(Avg_AllowByLimit =

However, I really appreciate your help Sir!


William H. Poling, Ph.D., MPH | Manager, Data Science
Data Intelligence & Analytics
Zelis Healthcare

-----Original Message-----
From: Rui Barradas <ruipbarradas using sapo.pt>
Sent: Wednesday, May 22, 2019 9:46 AM
To: Bill Poling <Bill.Poling using zelis.com>; r-help (r-help using r-project.org) <r-help using r-project.org>
Subject: Re: [R] Help with R coding


Maybe filter the AllowByLimitFlag values first (not tested)?

tmp1 <- tmp %>%
   group_by(HCPCSCode) %>%
   filter(AllowByLimitFlag) %>%
   summarise(Avg_AllowByLimit =

Hope this helps,

Rui Barradas

Às 13:35 de 22/05/19, Bill Poling escreveu:
> tmp1 <- tmp %>%
> group_by(HCPCSCode) %>%
> summarise(Avg_AllowByLimit = mean(Avg_AllowByLimit[which(Avg_AllowByLimit!=0)]))
> # But I need Something like that + This
> WHERE AllowByLimitFlag == TRUE

Confidentiality Notice This message is sent from Zelis. This transmission may contain information which is privileged and confidential and is intended for the personal and confidential use of the named recipient only. Such information may be protected by applicable State and Federal laws from this disclosure or unauthorized use. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any disclosure, review, discussion, copying, or taking any action in reliance on the contents of this transmission is strictly prohibited. If you have received this transmission in error, please contact the sender immediately. Zelis, 2018.

More information about the R-help mailing list