# Identify variables within specific functions, such as 'asymS'
parsed<-parseFormula(y ~ x +det(s + d) + asymS(d + s),"asymS()")
parsed
# Parse formulas containing various collection types like () or []
formula_ <- y ~ x +det(s -gg- d) + asymS(d2 -rr+ s)-mm[y1+y2+y3]+asym[k1+k2+k3]+trend-huseyin
# Extract variables in the 'asymS' function
parseFormula(formula_,"asymS")
# Use multiple functions to extract variables. If a specified function, such as "uuu",
# is not found, nothing is returned for it
a<-parseFormula(formula_,c("mm","det","uuu"))
# To obtain variables not enclosed within any function, specify them directly
parseFormula(formula_,c("trend","huseyin"))
# By default, 'parseFormula()' is case-sensitive.
# For case-insensitive matching, set 'ignore.case = TRUE'
parseFormula(formula_,"asyms", TRUE)
Run the code above in your browser using DataLab