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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:04:00+00:00 2026-05-30T17:04:00+00:00

I have a big data frame taking about 900MB ram. Then I tried to

  • 0

I have a big data frame taking about 900MB ram. Then I tried to modify it like this:

dataframe[[17]][37544]=0 

It seems that makes R using more than 3G ram and R complains “Error: cannot allocate vector of size 3.0 Mb”, ( I am on a 32bit machine.)

I found this way is better:

dataframe[37544, 17]=0

but R’s footprint still doubled and the command takes quite some time to run.

From a C/C++ background, I am really confused about this behavior. I thought something like dataframe[37544, 17]=0 should be completed in a blink without costing any extra memory (only one cell should be modified). What is R doing for those commands I posted? What is the right way to modify some elements in a data frame then without doubling the memory footprint?

Thanks so much for your help!

Tao

  • 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-30T17:04:02+00:00Added an answer on May 30, 2026 at 5:04 pm

    Look up ‘copy-on-write’ in the context of R discussions related to memory. As soon as one part of a (potentially really large) data structure changes, a copy is made.

    A useful rule of thumb is that if your largest object is N mb/gb/… large, you need around 3*N of RAM. Such is life with an interpreted system.

    Years ago when I had to handle large amounts of data on machines with (relative to the data volume) relatively low-ram 32-bit machines, I got good use out of early versions of the bigmemory package. It uses the ‘external pointer’ interface to keep large gobs of memory outside of R. That save you not only the ‘3x’ factor, but possibly more as you may get away with non-contiguous memory (which is the other thing R likes).

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

Sidebar

Related Questions

I have a big dataframe, but small example would be like this: mydf <-
Say I have a data frame like this: Df <- data.frame( V1 = c(1,2,3,NA,5),
I'm struggling with the following. If have a (big) data frame with the following:
I have this big data-entry sort of page, a table kind of layout using
Suppose that you have a big Data Entry Web Application Like Microsoft CRM ,
i have a very big data frame((35000 line) but i want to get specific
I have been playing around with using graphs to analyze big data. Its been
I have a big lump of binary data in a char[] array which I
I have a big problem dealing with data I try to download in my
I have a big chunk of HTML which is a template for some data

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.