Function that extracts the last name in a string representing an object as in e.g. obj$x$y
.
It returns a list containing both the piece before the last occurrence of $
and the name coming after it.
The object may or may not exist.
extract_root_and_last_member(full_name)
character scalar from which we should keep the piece that comes after the last $
sign.
A list with two members: root
containing the path to the last name of the object expression
and name
, containing the last name in the object expression.
The root
is empty when there is no $
in the input string.
Ex: extract_root_and_last_member("obj$x$y")
returns list(root="obj$x", name="y")
.