Re: [R] Adding Year-Month-Day to X axis

2018-05-06 Thread Gregory Coats
Thanks. Regarding axis(1,at=x_mmdd,labels=format(x_mmdd,"%Y-%m-%d")) How do I get the text for -MM-DD to be drawn vertically, instead of horizontally? Greg > On May 6, 2018, at 11:54 PM, Jim Lemon wrote: > > axis(1,at=x_mmdd,labels=format(x_mmdd,"%Y-%m-%d")) [[al

Re: [R] Adding Year-Month-Day to X axis

2018-05-06 Thread Jim Lemon
Look at par(las=2) in the graphics package. You will almost certainly have to increase the bottom margin, e.g.: par(mar=c(6,4,4,2) to accomodate the vertical labels. Jim On Mon, May 7, 2018 at 2:11 PM, Gregory Coats wrote: > Thanks. Regarding > axis(1,at=x_mmdd,labels=format(x_mmdd,"%

Re: [R] Adding Year-Month-Day to X axis

2018-05-06 Thread Jim Lemon
Hi Greg, Easy: plot (x_mmdd, y_duration, type="l", xaxt="n", yaxt="n", ylim=range(240,480)) abline (h=c(240,270,300,330,360,390,420,450,480,510,540), lty=2, lwd=1.0, col="grey40") axis(1,at=x_mmdd,labels=format(x_mmdd,"%Y-%m-%d")) axis(2,at=seq(240,480,by=60),labels=c("4.00","5.00","

Re: [R] Adding Year-Month-Day to X axis

2018-05-06 Thread Gregory Coats
Jim, Thank you very much! How do I use the axis command for side=1 to label the x horizontal axis, in the format="%Y-%m-%d” style? Greg y_duration <- c (301.59050, 387.35700, 365.64366, 317.26150, 321.71883, 342.44950, 318.95350, 322.33233, 330.60333, 428.99516, 297.82066, 258.23166)

Re: [R] adding overall constraint in optim()

2018-05-06 Thread Eric Berger
typo: lambda * (sum(wgt.wect) - 1) On Sun, May 6, 2018 at 10:51 AM, Eric Berger wrote: > Hi Michael, > A few comments > 1. To add the constraint sum(wgt.vect=1) you would use the method of > Lagrange multipliers. > What this means is that in addition to the w_i (the components of the > weig

Re: [R] Adding Year-Month-Day to X axis

2018-05-06 Thread Jim Lemon
Hi Greg, By default, the "axis" function puts the labels on one line and drops labels that would overlap. When you have labels that are all the same length, this usually results in every second, or third, or fourth label being displayed. So you can probably get what you want by not using staxlab. H

Re: [R] adding overall constraint in optim()

2018-05-06 Thread Eric Berger
Hi Michael, A few comments 1. To add the constraint sum(wgt.vect=1) you would use the method of Lagrange multipliers. What this means is that in addition to the w_i (the components of the weight variables) you would add an additional variable, call it lambda. Then you would modify your opti