On Dec 1, 2009, at 3:28 PM, Gabor Grothendieck wrote:
> Try this:
>
> > library(gsubfn)
> > strapply(testvec, "[-+.0-9]+", as.numeric, simplify = ~
> colMeans(cbind(...)))
> [1] -5.8500 -2.9800 -2.8160 -2.7120 -2.6325 -2.5680
Very, nice. Also tried on some other valid ("200,2") and
invalid )
Try this:
> library(gsubfn)
> strapply(testvec, "[-+.0-9]+", as.numeric, simplify = ~
colMeans(cbind(...)))
[1] -5.8500 -2.9800 -2.8160 -2.7120 -2.6325 -2.5680
On Tue, Dec 1, 2009 at 3:14 PM, David Winsemius wrote:
> I'm sitting here chuckling. Your solution is just so "pure".
>
> I would offer
I'm sitting here chuckling. Your solution is just so "pure".
I would offer an enhancement. When I tested with my cuts that had "-"
before the digits, you solution dropped them, so my suggestion for the
pattern would be: "[-[:digit:].]+"
I will admit that I thought it might fail with posit
Perhaps this shoul work too:
sapply(strsplit(gsub("^\\W|\\W$", "", testvec), ","),
function(x)sum(as.numeric(x))/2)
On Tue, Dec 1, 2009 at 5:41 PM, David Winsemius wrote:
> Starting with the head of a 499 element matrix whose column names are now
> the labels trom a cut() operation, I needed to
You also might want to look at
demo("gsubfn-cut")
On Tue, Dec 1, 2009 at 2:41 PM, David Winsemius wrote:
> Starting with the head of a 499 element matrix whose column names are now
> the labels trom a cut() operation, I needed to get to a vector of midpoints
> to serve as the basis for plotting
Starting with the head of a 499 element matrix whose column names are
now the labels trom a cut() operation, I needed to get to a vector of
midpoints to serve as the basis for plotting a calibration curve
( exp(linear predictor) vs. :
> dput(head(dimnames(mtcal)[2][[1]])) # was starting po
6 matches
Mail list logo