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

2018-05-05 Thread Gregory Coats
Jim, That you very much! How do I instruct staxlab to label once every n days, rather than labeling every day? Greg > On May 5, 2018, at 6:50 PM, Jim Lemon wrote: > > staxlab(1,at=x_mmdd,labels=format(x_mmdd,"%Y-%m-%d")) [[alternative HTML version

Re: [R] why the length and width of a plot region produced by the dev.new() function cannot be correctly set?

2018-05-05 Thread sunyeping via R-help
--From:Duncan Murdoch Send Time:2018 May 6 (Sun) 04:58To:孙业平 ; David Winsemius Cc:R Help Mailing List Subject:Re: [R] why the length and

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

2018-05-05 Thread Jim Lemon
Hi Greg, The only reason I included the staxlab function in the plotrix library was to fit all the dates onto the axis. If you want to try it: install.packages("plotrix") Jim On Sun, May 6, 2018 at 9:02 AM, Gregory Coats wrote: > Jim, Thanks for responding! > I am using the

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

2018-05-05 Thread Bert Gunter
"Apparently, R does not understand my Year-Month-Day " I think, rather, you need to learn how R handles dates and times. See here to begin, perhaps: ?DateTimeClasses There are many R resources for dealing with data over time, many of which are listed here, and others might be found by online

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

2018-05-05 Thread Jim Lemon
Hi Greg, What you are getting there is a factor, interpreted as a 1:n sequence based on the sort order of your "dates". Here's a way to get dates on your x-axis in the format you want: x_mmdd<-as.Date(c("2018-04-25","2018-04-26","2018-04-27",

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

2018-05-05 Thread Gregory Coats
I am using R 3.5.0 for Mac OS X. Issuing these two commands yields the expected plot. 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) plot (y_duration, type="l”) Adding Year-Month-Day values for

Re: [R] Discovering patterns in textual strings

2018-05-05 Thread Bert Gunter
Jeff: The previous solution I sent you was hugely inefficient and frankly kind of stupid. Here is a much better and simpler solution. > z <- c("abc", "abc_def", "abc.def", "abc def", "abcd_ef", "abcd", "e","f") ## Create vector of patterns of same

Re: [R] why the length and width of a plot region produced by the dev.new() function cannot be correctly set?

2018-05-05 Thread Duncan Murdoch
On 05/05/2018 11:33 AM, 孙业平 wrote: -- From:Duncan Murdoch Send Time:2018 May 4 (Fri) 17:24 To:孙业平 ; David Winsemius Cc:R Help Mailing List

Re: [R] [Rd] source(echo = TRUE) with a iso-8859-1 encoded file gives an error

2018-05-05 Thread Scott Kostyshak
On Fri, May 04, 2018 at 10:58:26PM +, Ista Zahn wrote: > On Fri, May 4, 2018 at 4:47 PM, Scott Kostyshak wrote: > > I have very little knowledge about file encodings and would like to > > learn more. > > > > I've read the following pages to learn more: > > > > > >

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

2018-05-05 Thread Ravi Varadhan
Here is what you do for your problem: require(BB) Mo.vect <- as.vector(tail(head(mo,i),1)) wgt.vect <- as.vector(tail(head(moWeightsMax,i),1)) cov.mat <- cov(tail(head(morets,i+12),12)) opt.fun <- function(wgt.vect) -sum(Mo.vect %*% wgt.vect) / (t(wgt.vect) %*% (cov.mat %*%

[R] adding overall constraint in optim()

2018-05-05 Thread Ravi Varadhan
Hi, You can use the projectLinear argument in BB::spg to optimize with linear equality/inequality constraints. Here is how you implement the constraint that all parameters sum to 1. require(BB) spg(par=p0, fn=myFn, project="projectLinear", projectArgs=list(A=matrix(1, 1, length(p0)),

Re: [R] why the length and width of a plot region produced by the dev.new() function cannot be correctly set?

2018-05-05 Thread 孙业平 via R-help
--From:Duncan Murdoch Send Time:2018 May 4 (Fri) 17:24To:孙业平 ; David Winsemius Cc:R Help Mailing List Subject:Re: [R] why the length and

[R] error in chol.default((value + t(value))/2) : , the leading minor of order 1 is not positive definite

2018-05-05 Thread Troels Ring
Dear friends - I'm having troubles with nlme fitting a simplified model as shown below eliciting the error Error in chol.default((value + t(value))/2) :   the leading minor of order 1 is not positive definite - I have seen the threads on this error but it didn't help me solve the problem.

Re: [ESS] ess-insert-function-outline

2018-05-05 Thread Patrick Connolly
On Fri, 04-May-2018 at 10:23AM +0200, Lionel Henry wrote: |> |> |> > On 4 mai 2018, at 10:05, Patrick Connolly wrote: |> > |> > That's the same as what's in my lisp/old directory. What am I to |> > learn from that? |> |> You can copy-paste its contents into your

Re: [R] Discovering patterns in textual strings

2018-05-05 Thread Bert Gunter
"Does that help?" No. I am not your private consultant. You need to reply to the list, which I have cc'ed here, not just me. I am still somewhat confused by your specifications, but others may not be. Part of my confusion stems from your failure to provide a reproducible example (see e.g. the