Dear experts in regexpr.
I have this
dput(test[500:510])
c("pH 9,36 2", "pH 9,36 3", "pH 9,66 1", "pH 9,66 2", "pH 9,66 3",
"pH 10,04 1", "pH 10,04 2", "pH 10,04 3", "RGLP 144006 pH 6,13 1",
"RGLP 144006 pH 6,13 2", "RGLP 144006 pH 6,13 3")
and I want something like this
gsub("^.*([[:digit:]],[[:digit:]]*).*$", "\\1", test[500:510])
[1] "9,36" "9,36" "9,66" "9,66" "9,66" "0,04" "0,04" "0,04" "6,13" "6,13"
[11] "6,13"
but with 10,04 values instead of 0,04.
I tried
gsub("^.*([[:digit:]]+,[[:digit:]]*).*$", "\\1", test[500:510])
or other variations but without any success.
Please help.
Regards
Petr
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.