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

  • Home
  • SEARCH
  • 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 6239713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:26:21+00:00 2026-05-24T11:26:21+00:00

Is it possible to remove an element from … and pass … onto other

  • 0

Is it possible to remove an element from … and pass … onto other functions? My first two attempts failed:

parent = function(...)
{

   a = list(...)
   str(a)
   a$toRemove = NULL  
   str(a)

   # attempt 1   
   child(a)   

   # attempt 2
   child( ... = a )
}


child = function(...)
{
  a = list( ... )
  str(a)
}

parent( a = 1 , toRemove = 2 )

Edit
Sorry about the confusion. I fixed child(). The intent was to have child list the contents of …

Edit2
Here’s more of a real-world example (but still fairly simple so we can have a useful conversation about it). Parent is called via recursion. Parent need to know the depth of the recursive call. Callers outside of parent should’t know about “depth” nor should they set it when calling parent(). Parent calls other functions, in this case child(). Child needs values in … Clearly child doesn’t need “depth” because parent generated it for its own use.

parent = function( ... )
{

   depth = list(...)$depth      
   if ( is.null( depth ) )
   {
       depth = 1
   }  
   print( depth )

   # parent needs value of depth to perform various calculations (not shown here)

   if ( depth == 5 )
   {
       return()
   }
   else
   {
      # child doesn't need "depth" in ...
      child( ... ) 
   }

   # yikes!  now we've added a second, third, etc. depth value to ...
   parent( depth = depth + 1 , ... )

}


child = function(...) 
{       
    # does some magic    
}
  • 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-05-24T11:26:22+00:00Added an answer on May 24, 2026 at 11:26 am

    One way to manipulate these things is to wrap the child function inside parent, and use a definition that puts any arguments you don’t want passing on to child after the ... argument. For example:

    parent <- function(...) {
        localChild <- function(..., toRemove) child(...)
        localChild(...)
    }
    child <- function(a) {
        a + 10
    }
    
    > parent(a = 1, toRemove = 10)
    [1] 11
    

    Another way is to use do.call():

    parent2 <- function(...) {
        a <- list(...)
        a$toRemove <- NULL
        do.call(child2, a)
    }
    child2 <- function(b) {
        b + 10
    }
    > parent2(b = 1, toRemove = 10)
    [1] 11
    

    Depending on your actual use case, the do.call() is perhaps closest to what you intended with your Question.

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

Sidebar

Related Questions

Possible Duplicate: PHP: How to remove specific element from an array? How can i
Is it possible to remove just the translation element from a Matrix object so
It is possible to add and remove elements from an enum in Java at
Is it possible to remove than add back click event to specific element? i.e
Possible Duplicate: Can you remove elements from a std::list while iterating through it? I
I accidentally pushed a commit to GitHub. Is it possible to remove this commit?
Is it possible for the compiler to remove statements used for debugging purposes (such
Is it even possible? Basically, there's a remote repository from which I pull using
I would like to iterate over a Set and remove the elements from the
Possible Duplicate: remove duplicate elements in an array in O(n) in C/C++ How can

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.