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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:46:09+00:00 2026-05-26T02:46:09+00:00

I am trying to figure out why certain arrays I am saving as .rda’s

  • 0

I am trying to figure out why certain arrays I am saving as .rda’s seem to eat up more memory than others of equal size. Below are two objects, x and y,of the same size, type, and dimension. When I save each of these, one is 41 Mb and the other is 6Mb. Can anyone think of a reason why this could happen?

> dim(x)
[1]    71    14 10000
> dim(y)
[1]    71    14 10000 
> class(x)
[1] "array"
> class(y)
[1] "array"  
> object.size(y)
79520208 bytes
> object.size(x)
79520208 bytes
  • 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-26T02:46:10+00:00Added an answer on May 26, 2026 at 2:46 am

    If you save using either the save or saveRDS commands, the default is to use compression. If you have different content in the vectors, they’ll compress differently…

    Try save with compress=FALSE and compare again…

    In the example below there is almost a 700x difference in file size:

    set.seed(42)
    x <- runif(1e6)  # random values should not compress well...
    y <- rep(0, 1e6) # zeroes should compress very well...
    object.size(x) # 8000040 bytes
    object.size(y) # 8000040 bytes
    
    save('x', file='x.rds')
    save('y', file='y.rds')
    file.info(c('x.rds', 'y.rds'))$size
    #[1] 5316773    7838
    
    save('x', file='x.rds', compress=FALSE)
    save('y', file='y.rds', compress=FALSE)
    file.info(c('x.rds', 'y.rds'))$size
    #[1] 8000048 8000048
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to figure out certain memory leak conditions in javascript on a
I am trying to figure out a way to cut out a certain region
I have a (simple) sitemap and am trying to figure out why a certain
I am trying to figure out how to exact a certain part of a
I am trying to figure out the math for rotating a UIView a certain
I am really having trouble trying to figure out how to find certain records
I am trying to figure out how to make my game draw a certain
I'm trying to figure out how to automatically add all files of a certain
I'm trying to figure out how to get my regular expression to accept certain
I'm trying to figure out the total VOLUME of certain products in my database,

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.