hsSafeName | R Documentation |
Returns a name that is not yet contained in a vector myNames of existing names.
hsSafeName(myName, myNames)
myName |
desired name. |
myNames |
vector of existing names. |
If myName is not contained in myNames it is returned. Otherwise myName is modified to myName_01, myName_02, ... until a non-existing name is found that is then returned.
existing <- c("a", "b")
myName <- hsSafeName("c", existing)
myName # "c"
myName <- hsSafeName("a", existing)
myName # "a_1"
hsSafeName("a", c(existing, myName)) # "a_2"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.