Displaying 1 result from an estimated 1 matches for "testintvl".
Did you mean:
testint
2009 Dec 01
2
Cut intervals (character) to numeric midpoint; regex problem
...-2.756,-2.668]",
"(-2.668,-2.597]", "(-2.597,-2.539]")
I started this message with the thought of requesting an answer but
kept asking myself if I really had check the docs and tested my
understanding. I eventually solved it using the gsubfn from the gsubfn
package:
testintvl <-as.numeric(gsubfn("\\((-?[[:digit:]]+.?[[:digit:]]*),
(-?[[:digit:]]+.?[[:digit:]]*)\\]",
~ (as.numeric(x)+as.numeric(y))/2, testvec))
# I did discover that carriage returns in the middle of the pattern
will not give desired results, so if this is broken by your mail-
client, be...