Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7916973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:59:28+00:00 2026-06-03T14:59:28+00:00

Possible Duplicate: How do you you determine the namespace of a function? I don’t

  • 0

Possible Duplicate:
How do you you determine the namespace of a function?

I don’t know how to do this… How do you know the package name for a certain function in R? I would like to have a function that given the name of a function, returns the name of the package that owns it. Any suggestion?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:59:31+00:00Added an answer on June 3, 2026 at 2:59 pm

    There may be better solutions, but find("functionname") seems to work reasonably well? However, it only works for loaded packages.

    > find("strwidth")
    [1] "package:graphics"
    > find("qplot")
    character(0)
    > library(ggplot2)
    > find("qplot")
    [1] "package:ggplot2"
    > 
    

    (If you need the raw name of the package you can use gsub("^package:","",results))

    (The answers to the previous question linked by Andrie include this answer; they don’t give the bit about gsub, and they all seem to share the issue of not finding non-loaded packages.)

    Here’s a quick hack to find functions even in non-loaded packages:

    findAllFun <- function(f) {
        h <- help.search(paste0("^",f,"$"),agrep=FALSE)
        h$matches[,"Package"]
    }
    
    findAllFun("qplot")
    ## "ggplot2"
    findAllFun("lambertW")
    ## "emdbook"    "VGAM" 
    > findAllFun("xYplot")
    ## "Hmisc" "lattice" 
    

    If you need to find functions in non-installed packages (i.e. searching CRAN), then findFn from the sos package will be your friend.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Determine original name of variable after its passed to a function. I
Possible Duplicate: php: determine where function was called from I have an autoloading function
Possible Duplicate: Determine the parent process of the current app I would like to
Possible Duplicate: How do determine if a polygon is complex/convex/nonconvex? I'd like to know
Possible Duplicate: Finding the Variable Name passed to a Function in C# In C#,
Possible Duplicate: How to determine if a number is a prime with regex? This
Possible Duplicate: Php function to determine if a string consist of only alphanumerical characters?
Possible Duplicate: Determine a string's encoding in C# Many text editorsr (like Notepad++) can
Possible Duplicate: .NET: Determine the type of this class in its static method How
Possible Duplicate: How to determine the class of a generic type? I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.