Re: [R] Help with R coding

2019-05-22 Thread Bill Poling
Thank you William appreciate your response Sir. WHP From: William Michels Sent: Wednesday, May 22, 2019 9:58 AM To: Bill Poling Cc: r-help (r-help@r-project.org) Subject: Re: [R] Help with R coding Morning Bill, I take it this is dplyr? You might try: tmp1 <- HCPC %>% group_by(HCP

Re: [R] Help with R coding

2019-05-22 Thread Bill Poling
Thank you Jeff! WHP From: Jeff Newmiller Sent: Wednesday, May 22, 2019 10:06 AM To: r-help@r-project.org; Rui Barradas ; Bill Poling ; r-help (r-help@r-project.org) Subject: Re: [R] Help with R coding Generally more efficient to filter before grouping. Note that summarize clears out

Re: [R] Help with R coding

2019-05-22 Thread Jeff Newmiller
Generally more efficient to filter before grouping. Note that summarize clears out whatever isn't mentioned in it, so the subsetting currently being done in the mean call could also be done in the pre-filter step and you can avoid filtering other columns and then discarding them by limiting

Re: [R] Help with R coding

2019-05-22 Thread William Michels via R-help
Morning Bill, I take it this is dplyr? You might try: tmp1 <- HCPC %>% group_by(HCPCSCode) %>% summarise(Avg_AllowByLimit = mean(Avg_AllowByLimit[which(Avg_AllowByLimit!=0 & AllowByLimitFlag == TRUE)])) The code above gives "NaN" for cases where AllowByLimitFlag == FALSE. Maybe this is the

Re: [R] Help with R coding

2019-05-22 Thread Bill Poling
Zelis Healthcare -Original Message- From: Rui Barradas Sent: Wednesday, May 22, 2019 9:46 AM To: Bill Poling ; r-help (r-help@r-project.org) Subject: Re: [R] Help with R coding Hello, Maybe filter the AllowByLimitFlag values first (not tested)? tmp1 <- tmp %>% group_by(HC

Re: [R] Help with R coding

2019-05-22 Thread Rui Barradas
Hello, Maybe filter the AllowByLimitFlag values first (not tested)? tmp1 <- tmp %>% group_by(HCPCSCode) %>% filter(AllowByLimitFlag) %>% summarise(Avg_AllowByLimit = mean(Avg_AllowByLimit[which(Avg_AllowByLimit!=0)])) Hope this helps, Rui Barradas Às 13:35 de 22/05/19, Bill Poling

[R] Help with R coding

2019-05-22 Thread Bill Poling
Good morning. #R version 3.6.0 Patched (2019-05-19 r76539) #Platform: x86_64-w64-mingw32/x64 (64-bit) #Running under: Windows >= 8 x64 (build 9200) I need a calculated field For the Rate of Avg_AllowByLimit where the Allowed_AmtFlag = TRUE BY Each Code I have almost got this. #So far I have

Re: [R] Help on R Coding

2008-10-05 Thread andyer weng
Hi all, I am kind of stuck of using Predict function in R to make prediction for a model with continuous variable and categorial variables. i have no problem making the model, the model is e.g. cabbage.lm2- lm(VitC ~ HeadWt + Date + Cult) HeadWt is a continuous variable, Date and Culte are

Re: [R] Help on R Coding

2008-10-05 Thread Yihui Xie
You used variable names 'Date' and 'Cult' in lm2, but *different* names 'Cultc52' and 'Dated16' for prediction. Regards, Yihui -- Yihui Xie [EMAIL PROTECTED] Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 Mobile: +86-15810805877 Homepage: http://www.yihui.name School of Statistics, Room 1037,

Re: [R] Help on R Coding

2008-10-04 Thread andyer weng
Hi all, I am kind of stuck of using Predict function in R to make prediction for a model with continuous variable and categorial variables. i have no problem making the model, the model is e.g. cabbage.lm2- lm(VitC ~ HeadWt + Date + Cult) HeadWt is a continuous variable, Date and Culte are