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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:23:07+00:00 2026-05-23T02:23:07+00:00

Is it possible to create a progress bar for data loaded into R using

  • 0

Is it possible to create a progress bar for data loaded into R using load()?

For a data analysis project large matrices are being loaded in R from .RData files, which take several minutes to load. I would like to have a progress bar to monitor how much longer it will be before the data is loaded. R already has nice progress bar functionality integrated, but load() has no hooks for monitoring how much data has been read. If I can’t use load directly, is there an indirect way I can create such a progress bar? Perhaps loading the .RData file in chucks and putting them together for R. Does any one have any thoughts or suggestions on this?

  • 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-23T02:23:08+00:00Added an answer on May 23, 2026 at 2:23 am

    I came up with the following solution, which will work for file sizes less than 2^32 – 1 bytes.

    The R object needs to be serialized and saved to a file, as done by the following code.

    saveObj <- function(object, file.name){
        outfile <- file(file.name, "wb")
        serialize(object, outfile)
        close(outfile)
    }
    

    Then we read the binary data in chunks, keeping track of how much is read and updating the progress bar accordingly.

    loadObj <- function(file.name){
        library(foreach)
        filesize <- file.info(file.name)$size
        chunksize <- ceiling(filesize / 100)
        pb <- txtProgressBar(min = 0, max = 100, style=3)
        infile <- file(file.name, "rb")
        data <- foreach(it = icount(100), .combine = c) %do% {
            setTxtProgressBar(pb, it)
            readBin(infile, "raw", chunksize)
        }
        close(infile)
        close(pb)
        return(unserialize(data))
    }
    

    The code can be run as follows:

    > a <- 1:100000000
    > saveObj(a, "temp.RData")
    > b <- loadObj("temp.RData")
      |======================================================================| 100%
    > all.equal(b, a)
    [1] TRUE
    

    If we benchmark the progress bar method against reading the file in a single chunk we see the progress bar method is slightly slower, but not enough to worry about.

    > system.time(unserialize(readBin(infile, "raw", file.info("temp.RData")$size)))
       user  system elapsed
      2.710   0.340   3.062
    > system.time(b <- loadObj("temp.RData"))
      |======================================================================| 100%
       user  system elapsed
      3.750   0.400   4.154
    

    So while the above method works, I feel it is completely useless because of the file size restrictions. Progress bars are only useful for large files that take a long time to read in.

    It would be great if someone could come up with something better than this solution!

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

Sidebar

Related Questions

Is it possible to create a REST web service using ASP.NET 2.0? The articles
Is it possible to create Windows CE 5.0 images (ie: nk.bin) from VS2005/VS2008 without
Is it possible to create Selenium tests using the Firefox plugin that use randomly
Hi it'd like to know if it's at all possible create a parametric equalizer
Possible Duplicate: Create a temporary directory in Java Duplicate: stackoverflow.com/questions/375910 Is there a way
Possible Duplicate: Create Excel file in Java How to save output in excel format
Is it possible to create federated Subversion servers? As in one server at location
Is it possible to create a trigger that will not be in a transaction?
Is it possible to create images with PHP (as opposed to simply linking to
It's possible to create digrams in SQL Server 2000 that can be useful to

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.