Open In App

Find Location and Character Vector of an Object with partial name in R Language – apropos() and find() Function

Last Updated : 23 Dec, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we are going to find the location and character vector of an object with a partial name in R Programming Language.

R – apropos() Function

appros() function in R Language will give the character vector of name that contains the partial name.

Syntax: apropos(“x”, ignore.case, simple.word)

Parameters: 

  • x: partial-name of object
  • ignore.case: Case sensitive or not
  • simple.word: if TRUE the what is searched as a whole word

Example:

R




# R program to illustrate
# appros function
 
# Apply apropos function in R
apropos("max", ignore.case = FALSE, simple.word = FALSE)               


Output: 

“cummax”    “max”     “max.col”   “pmax”      “promax”    “varimax”   “which.max”

Here in the above code, the appros() function will return all the strings which have “max” in them.

R – find() Function

find() Function in R returns the location where the object with specific name can be found.

Syntax: find(“x”, ignore.case, simple.word)

Parameters: 

  • x: partial-name of object
  • ignore.case: Case sensitive or not
  • simple.word: if TRUE the what is searched as a whole word

Example:

R




# R program to illustrate
# find function
 
# Apply find function in R
find("varimax", ignore.case = FALSE, simple.word = FALSE)               


Output: 

# "package:stats

Here in the above code, we get the location of where “varimax” is stored. So find() function is used to find what we have specified to it.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads