Skip to content
Related Articles

Related Articles

apropos() and find() Functions in R?

Improve Article
Save Article
  • Last Updated : 30 Aug, 2022
Improve Article
Save Article

In this article, we will be discussing the aprops() and the find() functions with these working examples in the R programming language.

Functions definitions:

  • apropos() function:  This function returns a character vector giving the names of objects in the search list matching what.
  • find() function: This returns where objects of a given name can be found.

Syntax:

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

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

Parameters:

  • what: character string. For simple.words = FALSE the name of an object; otherwise, a regular expression to match object names 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.
  • 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 a whole word.

Example:

In this example, we are calling the apropos function with the string “mean” passed to the function as the parameter, and further in return we are getting all the R objects with a name containing the character “mean” the R programming language.

R




apropos("mean")


Output:

 [1] “.colMeans”     “.rowMeans”     “colMeans”      “kmeans”        “mean”          “mean.Date”     “mean.default” 

 [8] “mean.difftime” “mean.POSIXct”  “mean.POSIXlt”  “rowMeans”      “weighted.mean”

Example:

We are using the find() function with passed the read.csv() function as its parameter to get in the return the location of the passed function in the package in the R programming language.

R




find("read.csv")


Output:   

'package:utils'
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!