All, I am trying to extract values from text strings and I found the thread: Extracting decimal numbers from a string. However, the cases I am encountering are the numbers without a leading zero and the solution will drop the decimal point. For example:
> str <- "the value is .55"
> as.numeric(str_extract(str, "\\d+\\.*\\d*"))
[1] 55
I am hoping to recover the 0.55 value instead of 55 and any help is greatly appreciated!