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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:54:59+00:00 2026-06-17T04:54:59+00:00

I am looking for parallel version of aggregate() function and looks like http://cran.r-project.org/web/packages/mapReduce/mapReduce.pdf together

  • 0

I am looking for parallel version of aggregate() function and looks like http://cran.r-project.org/web/packages/mapReduce/mapReduce.pdf together with http://cran.r-project.org/web/packages/multicore/multicore.pdf is exactly what I am looking for.

So as a test I’ve created a dataset with 10m records

blockSize <- 5000
records <- blockSize * 2000
df <- data.frame(id=1:records, value=rnorm(records))
df$period <- round(df$id/blockSize)
# now I want to aggregate by period and return mean of every block:
x <- aggregate(value ~ period, data=df, function(x) { mean(x) })
# with mapReduce it can be done
library(multicore)
library(mapReduce)
jobId <- mcparallel(mapReduce(map=period, mean(value), data=df))
y <- collect(jobId)

but still somehow it doesn’t utilise all 4 CPU cores on my laptop:

$ top
02:00:35 up 3 days, 18:14,  3 users,  load average: 1,61, 1,20, 0,79
Tasks: 237 total,   2 running, 235 sleeping,   0 stopped,   0 zombie
%Cpu0  : 17,4 us,  5,1 sy,  0,0 ni, 74,3 id,  0,0 wa,  0,0 hi,  3,2 si,  0,0 st
%Cpu1  : 13,4 us,  6,9 sy,  0,0 ni, 79,7 id,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st
%Cpu2  : 21,3 us, 32,3 sy,  0,0 ni, 46,3 id,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st
%Cpu3  : 17,0 us, 36,0 sy,  0,0 ni, 47,0 id,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st
KiB Mem:   3989664 total,  3298340 used,   691324 free,    27248 buffers
KiB Swap:  7580668 total,  1154164 used,  6426504 free,   320360 cached

PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND
459 myuser    20   0 1850m 1,8g 1120 R  **99,1** 46,4   0:37.43 R

I use R 2.15.1:

R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-pc-linux-gnu (32-bit)

What am I doing wrong and how to aggregate huge datasets in R utilising multicore?

Thanks.

  • 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-17T04:55:00+00:00Added an answer on June 17, 2026 at 4:55 am

    How do you aggregate huge data sets in R?

    Use data.table

    library(data.table)
    
    
    DT <- data.table(df)
    setkey(DT, period)
    
    DT[, list(value = mean(value)), by = period]
    

    This will not use multiple cores, but will be extremely fast and memory efficient.

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

Sidebar

Related Questions

I'm looking into using parallel unit tests for our project(s) and was wondering about
I'm looking for a good strategy to truly decouple, for parallel processing, my web
I'm looking for a simple process-based parallel map for python, that is, a function
I'm looking to map a modestly-expensive function onto a large lazy seq in parallel.
Looking for Parallel Coordinates chart for GWT I need to show something like the
While looking into parallel programming, and subsequently evaluation strategies, the question whether thunks are
I've been looking at the new Scala 2.9 parallel collections and am hoping to
I have some experience using parallel extensions in .Net development, but I was looking
I was looking into Intel's Parallel Studio. It said it is for C &
Looking for some guidance on this issue (below is a parallel example): I have

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.