[R] tapply and error bars

2018-06-22 Thread Ogbos Okike
Dear workers, I have a data of length 1136. Below is the code I use to get the means B. It worked fine and I had the mean calculated and plotted. I wish to plot the error bars as well. I already plotted such means with error bars before. Please see attached for example. I tried to redo the same p

Re: [R] as.Date and Legend in a plot

2018-06-22 Thread MacQueen, Don via R-help
What David Winsemius said, plus: Does legend('topleft', c("Climax", "Thule", "Sopo"), lty = 1, col = ("black","red","blue")) not work? It should, which will illustrate that you CAN add a legend to the plot. The x,y that you supply to legend must be values that are within the x,y range of the

Re: [R] as.Date and Legend in a plot

2018-06-22 Thread David Winsemius
> On Jun 22, 2018, at 12:12 PM, Ogbos Okike wrote: > > Dear Contributors, > > I am surprised that I cannot add legend to a certain plot. Although the > x-axis indicates years, the actual data was in year, month and day format. > I then used as.Date to play around and get what I am looking for.

[R] as.Date and Legend in a plot

2018-06-22 Thread Ogbos Okike
Dear Contributors, I am surprised that I cannot add legend to a certain plot. Although the x-axis indicates years, the actual data was in year, month and day format. I then used as.Date to play around and get what I am looking for. I am, however, worried that I cannot add legend to the plot no mat

Re: [R] Help with transpose please.

2018-06-22 Thread Bill Poling
Thank you Ramesh, I will investigate, appreciate your response Sir! WHP From: Ramesh YAPALPARVI [mailto:ramesh.yapalpa...@icloud.com] Sent: Friday, June 22, 2018 7:47 AM To: Bill Poling Cc: r-help (r-help@r-project.org) Subject: Re: [R] Help with transpose please. Please check out tidyr packa

Re: [R] Help with transpose please.

2018-06-22 Thread Bill Poling
Hi Bert and thank you for your assistance, I will try this. I was not clear enough about the number of expected output columns based on the DiagnosisCode column, my appologies. Specifically, by virtue of the ClaimServiceID being the unique identifier, among them there is one with 12 DiagnosisC

Re: [R] Help with transpose please.

2018-06-22 Thread Bert Gunter
1. "The max number of columns based on this transpose of the DiagnosisCode column (in this dataset) is 12 if that is important to know." I count about 20 different DX codes in the data you show, so I don't know what this means. 2. I was not able to unambiguously parse your request (I admit that I

[R] Coxme, package updated on May 2018, Similar case to Re: CoxME: Family relatedness

2018-06-22 Thread Sarahí Rueda Salazar
Dear Terry, I can imagine that you are overwhelming with a quite large demand of request emails, so I hope (always optimistic) that you have time to see this email. It is related to the recently updated version of coxme package. Currently, I work with multistate models with changes in health sta

Re: [R] Help with transpose please.

2018-06-22 Thread Ramesh YAPALPARVI
Please check out tidyr package and use commands like spread/ gather which would make data wide or long > On Jun 22, 2018, at 07:43, Bill Poling wrote: > > Good morning. > > > I have data in the form: > > head(Edit041IA, n=25) > ClaimServiceID ClaimID DiagnosisCode > 1 183056004 78

[R] Help with transpose please.

2018-06-22 Thread Bill Poling
Good morning. I have data in the form: head(Edit041IA, n=25) ClaimServiceID ClaimID DiagnosisCode 1 183056004 78044473 C562 2 183056004 78044473 C778 3 183056004 78044473 C784 4 183056004 78044473 C786 5 183056004 78044473

Re: [R] Optimisation with Normalisation Constraint

2018-06-22 Thread Hans W Borchers
One way will be to solve this as an ordinary optimization problem with an equality constraint. Function `alabama::auglag` can do this: library(alabama) fn <- function(p) sum((df$y - p[1]*exp(-p[2]*df$x))^2) heq <- function(p) sum(p[1]*exp(-p[2]*df$x)) - 5 # Start with initial valu