apropos                package:utils                R Documentation

_F_i_n_d _O_b_j_e_c_t_s _b_y (_P_a_r_t_i_a_l) _N_a_m_e

_D_e_s_c_r_i_p_t_i_o_n:

     'apropos()' returns a character vector giving the names of all
     objects in the search list matching 'what'.

     'find()' is a different user interface to the same task.

_U_s_a_g_e:

     apropos(what, where = FALSE, ignore.case = TRUE, mode = "any")

     find(what, mode = "any", numeric = FALSE, simple.words = TRUE)

_A_r_g_u_m_e_n_t_s:

    what: character string with name of an object, or more generally a
          regular expression to match against.

where, numeric: a logical indicating whether positions in the search
          list should also be returned

ignore.case: logical indicating if the search should be
          case-insensitive, 'TRUE' by default.  Note that in R versions
          prior to 2.5.0, the default was implicitly 'ignore.case =
          FALSE'.

    mode: character; if not '"any"', only objects whose 'mode' equals
          'mode' are searched.

simple.words: logical; if 'TRUE', the 'what' argument is only searched
          as whole word.

_D_e_t_a_i_l_s:

     If 'mode != "any"' only those objects which are of mode 'mode' are
     considered. If 'where' is 'TRUE', the positions in the search list
     are returned as the names attribute.

     'find' is a different user interface for the same task as
     'apropos'. However, by default ('simple.words == TRUE'), only full
     words are searched with 'grep(fixed = TRUE)'.

     Note that in R versions prior to 2.5.0, 'what' was allowed to be
     non-character, such that 'find(cor)' worked as it does in S. This
     possibility has been dropped in line with the aim of minimizing
     all use of non-standard evaluation in R.

_V_a_l_u_e:

     For 'apropos' character vector, sorted by name, possibly with
     names giving the (numerical) positions on the search path.

     For 'find', either a character vector of environment names, or for
     'numeric = TRUE', a numerical vector of positions on the search
     path, with names giving the names of the corresponding
     environments.

_A_u_t_h_o_r(_s):

     Kurt Hornik and Martin Maechler (May 1997).

_S_e_e _A_l_s_o:

     'glob2rx' to convert wildcard patterns to regular expressions.

     'objects' for listing objects from one place, 'help.search' for
     searching the help system, 'search' for the search path.

_E_x_a_m_p_l_e_s:

     require(stats)

     ## Not run: apropos("lm")
     apropos("GLM")                      # more than a dozen
     ## that may include internal objects starting '.__C__' if
     ## methods is attached
     apropos("GLM", ignore.case = FALSE) # not one
     apropos("lq")

     cor <- 1:pi
     find("cor")        #> ".GlobalEnv"   "package:stats"
     find("cor", numeric=TRUE) # numbers with these names
     find("cor", numeric=TRUE, mode="function")# only the second one
     rm(cor)

     ## Not run: apropos(".", mode="list") # a long list

     # need a DOUBLE backslash '\\' (in case you don't see it anymore)
     apropos("\\[")

     ## Not run: # everything 
     length(apropos("."))

     # those starting with 'pr'
     apropos("^pr")

     # the 1-letter things
     apropos("^.$")
     # the 1-2-letter things
     apropos("^..?$")
     # the 2-to-4 letter things
     apropos("^.{2,4}$")

     # the 8-and-more letter things
     apropos("^.{8,}$")
     table(nchar(apropos("^.{8,}$")))
     ## End(Not run)

