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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:23:16+00:00 2026-06-12T11:23:16+00:00

Suppose I have create a list in R and append to it as follows:

  • 0

Suppose I have create a list in R and append to it as follows:

x = list(10)
x[[2]] = 20

Is this equivalent to

x = list(10)
x = list(10, 20)

? I’m not so experienced with the particular details of how R handles lists in memory, but my limited understanding is that it tends to be copy-happy; what would be ideal for me would be that the first option doesn’t involve essentially creating another list in memory, but just results in setting aside a new place in memory for the appended value. Essentially, if I have a big list, I don’t want R to make another copy of it if I just want to append something to it.

If the behaviour I want is not what is given here, is there any other way I can get the desired effect?

  • 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-12T11:23:17+00:00Added an answer on June 12, 2026 at 11:23 am

    I’m fairly confident the answer is “no”. I used the following code to double check:

    Rprof(tmp <- tempfile(), memory.profiling = TRUE)
    
    x <- list()
    for (i in 1:100) x[[i]] <- runif(10000)
    
    Rprof()
    summaryRprof(tmp, memory = "stats")
    unlink(tmp)
    

    The output:

    # index: runif
    #      vsize.small  max.vsize.small      vsize.large  max.vsize.large 
    #            76411           381781           424523          1504387 
    #            nodes        max.nodes     duplications tot.duplications 
    #          2725878         13583136                0                0 
    #          samples 
    #                5 
    

    The relevant part being duplications = 0.

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

Sidebar

Related Questions

Let us suppose I have a table created as follows: create table `test_table` (
Suppose I have a function like this: def getNeighbors(vertex) which returns a list of
Suppose I have a simple to-do list application. The application contains two models: lists
What is the simplest way to create this list in Python? First, suppose I
Suppose I have a doubly linked list. I create it as such: MyList list
Suppose I have a simple method like this for processing two lists: public static
Suppose I have a table like: create table { id numeric(5,3), code varchar(10) }
Suppose that we have following tables create table Employee( 2 EMPNO NUMBER(3), 3 ENAME
Suppose I have a user defined type: CREATE OR REPLACE TYPE TEST_TYPE AS OBJECT
Suppose I have the following: using(var ctx = DataContextFactory.Create(0)) { ... Some code ...

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.