These functions are used to match the name of a parameter with its position in a parameter list
toParamIndexes(m, string) matchIndexes(m, string)
a vector of names of the parameters of interest
a vector of parameter names
a vector where element i contains the position of m[i] in string
m[i]
string
if m contains integers and toParamIndexes is called, m will be returned, without a check of whether or not the indices are valid
m
toParamIndexes
if m[i] is not an element of string, toParamIndexes will display an error, whereas matchIndexes will return NA
matchIndexes
NA
https://github.com/gdancik/mlegp/
# NOT RUN { param.names = c("one", "two", "three") toParamIndexes(c("one", "three"), param.names) #toParamIndexes(c("four"), param.names) # will give an error # }
Run the code above in your browser using DataCamp Workspace