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 8771785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:52:40+00:00 2026-06-13T17:52:40+00:00

When we have defined tens of functions – probably to develop a new package

  • 0

When we have defined tens of functions – probably to develop a new package – it is hard to find out the name of a specific variable among many function names through ls() command.

In most of cases we are not looking for a function name – we already know they exist – but we want to find what was the name we assigned to a variable.

Any idea to solve it is highly appreciated.

  • 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-13T17:52:41+00:00Added an answer on June 13, 2026 at 5:52 pm

    If you want a function to do this, you need to play around a bit with the environment that ls() looks in. In normal usage, the implementation below will work by listing objects in the parent frame of the function, which will be the global environment if called at the top level.

    lsnofun <- function(name = parent.frame()) {
        obj <- ls(name = name)
        obj[!sapply(obj, function(x) is.function(get(x)))]
    }
    
    > ls()
    [1] "bar"           "crossvalidate" "df"           
    [4] "f1"            "f2"            "foo"          
    [7] "lsnofun"       "prod"         
    > lsnofun()
    [1] "crossvalidate" "df"            "f1"           
    [4] "f2"            "foo"           "prod"
    

    I’ve written this so you can pass in the name argument of ls() if you need to call this way down in a series of nested function calls.

    Note also we need to get() the objects named by ls() when we test if they are a function or not.

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

Sidebar

Related Questions

I have defined the following two functions test <- function(t) { return( (0.5*eta^2/theta)*(1-exp(-2*theta*t)) )
I have defined a table type PL/SQL variable and added some data there. create
I have defined style for TabWidget as below: <style name=MyTheme parent=@android:style/Theme.Light> <item name=android:tabWidgetStyle>@style/LightTabWidget</item> </style>
I have defined the following variable: myVar=true now I'd like to run something along
I have defined my bindings in the following way <jaxb:bindings node=xs:complexType[@name='Parent']> ........... <jaxb:bindings node=xs:element[@name='children']>
I have defined a new class type called Hotspot . I need 2 dynamic
I have defined a .dir-locals.el file with the following content: ((python-mode . ((cr/virtualenv-name .
I have defined a common lisp package using asdf which uses both parenscript and
I have defined following control template for my custom control. <ControlTemplate TargetType={x:Type local:CustomControl}> <Grid
I have defined the following class using COM to use the IGroupPolicyObject using C#.NET:

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.