I have some data with height strings which are formatted like so
"6'2\"" 
I'm capturing the first digit just fine, but I can't get rid of the
\"
from the end of the string
I've tried several ways of getting at it but nothing has worked yet. Here's where I'm currently at
inches <- str_extract(htString,"(\\d{1,2})[\\\"]?$")
[1] "11"
[1] "3\""
If the inches string is 2 digits long, I'm able to capture the right characters, otherwise, I'm capturing the \"
Thanks for any help!
Edit: Thanks for the help. The following code ended up working for me. It could be cleaned up I'm sure.
for(i in 1:nrow(hs)){
  htString <- hs[i,]$HtRec
  ft <- str_extract(htString, "^(\\d{1,2})[\']?")
  ft <- substring(ft, 1, 1)
  inches <- str_extract(htString,"(\\d{1,2})[\"]?$")
  inches <- str_extract_all(inches, "\\d+")
  ft <- as.numeric(ft)
  inches <- as.numeric(inches)
  htInches <- (ft * 12) + inches
  hs[i,]$HtRec <- htInches
}
 
     
    