Saturation with Parallel Computation in R

Saturation with Parallel Computation in R

I have just saturated all my PC:

full is the 4gb RAM


and so is the CPU (I7 4770 @3.4 GHZ)


Parallel Computation in R

which is my secret?

the doParallel package for R on mac

The package lets you make some very useful parallel computation, giving you the possibility to use all the potentiality of your CPU.

As a matter of fact, the standard R option is to use  just on of the cores you have got on your PC.

With parallel computation, just to say it easy, you can take your job, divide it in some smaller jobs, solve them and then put them together  in one new R object.

Tutorial ( More or Less)

There are some useful tutorial on the web (try to google it), but let me introduce the stuff in a really basic way so that you can immediately try it out:

cl = makeCluster(2) # if you want to use all your fire power, put the number of your cores
parallelization = function(x){
n = number #put here the number of repetitions you need
foreach ( i=1:n,.combine = rbind) { #this '.combine = rbind' let R understand that has to put the results together with an rbind function, you can use cbind as well

Final Warnings


sorry about the capital letters but I have been stacked on this error for quite a long time…

Finally, are you using Windows? instead of doParallel you can obtain the same result with doSNOW package.

comments are welcome.


How to Visualize Entertainment Expenditures on a Bubble Chart

How to Visualize Entertainment Expenditures on a Bubble Chart

Bubble Chart Categorical Variables Expenditures Analytics

I’ve been recently asked to analyze some Board entertainment expenditures in order to acquire sufficient assurance about their nature and responsible.

In response to that request I have developed a little Shiny app with an interesting reactive Bubble chart.


The plot, made using ggplot2 package, is composed by:
a categorical x value, represented by the clusters identified in the expenditures population
A numerical y value, representing the total amount expended
Points defined by the total amount of expenditure in the given cluster for each company subject.
Morover, point size is given by the ratio between amount regularly passed through Account Receivable Process and total amount of expenditure for that subject in that cluster.

The advantage i found in developing such a plot is the possibility to get a lot of information at a glance.

Reactivity is given by two sliders that let you decide the period and the range you want to analyze.

Full code (with italian comments, sorry about that) is given on GitHub, but let me underline some details:

Labels are made pasting subjects names and the amount show, in order to give you both information at once.

Colours are automatically assigned by ggplot function simply by specifying


Point size is simply obtained by putting

Hope you will find at least colorful the job.
Going on talking about colours: does anyone knows how to make point solid in this case?

Any feedback will be appreciated, but please be kind!