library(stringr)str_sub("0.959119909485581_171",1,str_locate("0.959119909485581_171","\\_")[1]-1)##[1] "0.959119909485581"