You can easily reproduce the parse
behavior with :
str <- "3a"
parse(text = str)
parse
try to parse your str as a variable name. Or, you should give an available variable name, either it should not begin with a digit or you should put it between ``. the following works :
str <- "`3a`"
parse(text = str)
and in your example , this works also :
str <- "abc12-`3def`"
parse(text = str)
Finally for your second example , it is logic that it will not work since you don't give an available expression to parse:
str <- "abc123-" ## this will like myvar-
if your -
is just a string separator, why not to transform it to _
? for example:
parse(text=gsub('-','_',str))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…