Displaying 5 results from an estimated 5 matches for "brenbarn".
2010 May 02
2
Retrieve regular expression groups
I'm trying to figure out how to get the text captured by capturing
groups out of a regex match. For instance, let's say I have the pattern
"foo ([^ ]+)" and I match it against the string "This is a foo sentence
I am reading." The group in the pattern will match the word "sentence"
in the target string. How can I get access to this matched group? All
I
2009 Sep 16
2
Generalized cumsum?
Is there anything like cumsum and cumprod but which allows you to
apply an arbitrary function instead of sum and product? In other words,
I want a function cumfunc(x, f) that returns a vector, so that for all n
up to the length of x
cumapply(x,f)[n] = f(x[1:n])
This would give cumsum and cumprod as special cases when f=sum or
f=prod.
I could write such a function, but I can't see
2009 Apr 19
1
ave returns wrong data type (PR#13664)
Full_Name: Brendan Barnwell
Version: 2.9.0
OS: Windows XP Pro
Submission from: (NULL) (71.102.131.29)
The ave() function returns an incorrect datatype. Specifically, ave(x, g, f)
always returns a vector with the same mode as x, rather than using the mode of
the vector returned by f. Observe:
> x
[1] "A" "B" "C" "A" "B" "C"
2009 Apr 15
0
ave returns wrong type
I've been using the ave function to compute some statistics on a
data frame. After a while I noticed that, for some reason, it was
returning numerical statistics as strings instead of numbers. I delved
into the code of the functions and traced the problem to the following
fact:
ave uses split<- to do its work. Specifically, it does "split(x,
g) <- lapply(split(x, g),
2009 Sep 16
1
Windows RGui line editing
I've been using Tinn-R with RGui on Windows for quite some time
now, but it's very irritating how the Windows RGui allows only very
rudimentary line-editing. I can't even use shift-arrow key to select
text!
I searched through the archives and found what seemed to be a few
people asking about this, but I couldn't find a clear answer. I saw
some references in the docs to