Re: [R] vectorized sub, gsub, grep, etc.

2015-08-03 Thread John Thaden
sub() has practical uses though gsub() may have more. This function was what I needed at the time. Of course the gsub() version is also possible. Sent from Yahoo Mail on Android [[alternative HTML version deleted]] __ R-help@r-project.org mai

Re: [R] vectorized sub, gsub, grep, etc.

2015-08-02 Thread John Thaden
Adam, The original posting gave a function sub2 whose aim differs both from your functions' aim and from the intent of mgsub() in the qdap package: > Here is code to apply a different > pattern and replacement for every target.#Example X <- c("ab", "cd", "ef") patt <- c("b", "cd", "a"

Re: [R] vectorized sub, gsub, grep, etc.

2015-07-31 Thread John Thaden
t;ef" By talking instead about simple string matching, I'm afraid you've rather hijacked the thread. -John  -John Adam wrote > I'm not sure I understand your question. Both functions return "" "CD" "" > because they > perform

Re: [R] vectorized sub, gsub, grep, etc.

2015-07-30 Thread John Thaden
Can you show what is its solution for the original sample data? Why that discrepancy for you original sub2() function? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.

Re: [R] vectorized sub, gsub, grep, etc.

2015-07-28 Thread John Thaden
tion(p,r,x) sub(p,r,x, fixed = TRUE),p=patt,r=repl,x=X))    user  system elapsed    2.53    0.00    2.52   #Old method 2 system.time(for(i in 1:5)sub2(patt, repl, X))   user  system elapsed    2.32    0.00    2.32   #Your proposed method system.time(for(i in 1:5) sub3(patt, repl, X))    user  s

Re: [R] predict.lm(...,type="terms") question

2012-09-02 Thread John Thaden
h to predict. If omitted, the fitted values are used. -John Thaden, Ph.D. College Station, TX --- On Sun, 9/2/12, peter dalgaard wrote: > From: peter dalgaard > Subject: Re: [R] predict.lm(...,type="terms") question > To: "David Winsemius" > Cc: "R

Re: [R] predict.lm(...,type="terms") question

2012-08-30 Thread John Thaden
Dave said my newdata data frame 'new' must have a column named 'area'. It did. Nonetheless predict.lm throws an error with type = "terms" and newdata = new. I see nothing in the predict.lm documentation that bars this usage. Is there a bug? To illustrate an OLS behavior, I had cited Ludbrook '12.

Re: [R] predict.lm(...,type="terms") question

2012-08-29 Thread John Thaden
Draper & Smith sections (3.2, 9.6) address prediction interval issues, but I'm also concerned with the linear fit itself. The Model II regression literature makes it abundantly clear that OLS regression of x on y frequently yields a different line than of y on x. The example below is not so extreme

Re: [R] predict.lm(...,type="terms") question

2012-08-29 Thread John Thaden
n Wed, Aug 29, 2012 at 9:16 AM, John Thaden wrote: > I think I may be misreading the help pages, too, but misreading how? > > I agree that inverting the fitted model is simpler, but I worry that I'm > misusing ordinary least squares regression by treating my response, with its >

Re: [R] predict.lm(...,type="terms") question

2012-08-29 Thread John Thaden
. > plot(concn ~ area, data = data) > abline(inv.model) > points(data$area, pred1, col="blue", pch="+") > points(new$area, pred2, col="red", pch=16) > > > Also, 'data' is a really bad variable name, it's already an R function. > > H

[R] predict.lm(...,type="terms") question

2012-08-28 Thread John Thaden
Hello all, How do I actually use the output of predict.lm(..., type="terms") to predict new term values from new response values? I'm a chromatographer trying to use R (2.15.1) for one of the most common calculations in that business: - Given several chromatographic peak areas measured for

Re: [R] jEdit for R

2007-10-26 Thread John Thaden
Michael, Where can we read you document that includes "various ideas going far beyond simply embedding R"? What about Julian's opinion that Tinn-R is more stable and loads more quickly than jEdit? Can that be true in a Windows environment? -John Thaden