# Blog Archives

January 2, 2015
By

## ggPlot2: Histogram with jittered stripchart

February 5, 2014
By

Here is an example of a Histogram plot, with a stripchart (vertically jittered) along the x side of the plot.Alternatively, using the geom_rug function:Of course this simplicistic method need to be adjusted in vertical position of the stripchart or rug...

## Boxplot with mean and standard deviation in ggPlot2 (plus Jitter)

February 2, 2014
By

When you create a boxplot in R, it automatically computes median, first and third quartile ("hinges") and 95% confidence interval of median ("notches").But we would like to change the default values of boxplot graphics with the mean, the mean + st...

## Implementation of the CDC Growth Charts in R

September 17, 2011
By

I implemented in R a function to re-create the CDC Growth Chart, according to the data provided by the CDC.In order to use this function, you need to download the .rar file available at this megaupload link.Mirror: mediafire link.Then unrar the file, a...

## R is a cool sound editor!

September 7, 2011
By

Capabilities of R are definitely unless! After my previous posts about some easy image editing in R (they are here, and here), now is the time to explore if R is capable of sound editing!Just for fun, here I created a function that receives a phone number (or another sequence of numbers), and returns the equivalent melody...

## R is a cool image editor #2: Dithering algorithms

August 29, 2011
By

Here I implemented in R some dithering algorithms: - Floyd-Steinberg dithering - Bill Atkinson dithering - Jarvis-Judice-Ninke dithering - Sierra 2-4a dithering - Stucki dithering - Burkes dithering - Sierra2 dithering - Sierra3 dithering For each algorithm, I wrote a 2-dimensional convolution function (a matrix passing over a matrix); it is slow because I didn't implemented any fasting tricks. It can be easily implemented in C, then used...

## Benford’s law, or the First-digit law

August 25, 2011
By

Benford's law, also called the first-digit law, states that in lists of numbers from many (but not all) real-life sources of data, the leading digit is distributed in a specific, non-uniform way. According to this law, the first digit is 1 about 30% of the time, and larger digits occur as the leading digit with lower and lower frequency,...

## How to plot points, regression line and residuals

June 16, 2011
By

x y # plot scatterplot and the regression linemod1 plot(x, y, xlim=c(min(x)-5, max(x)+5), ylim=c(min(y)-10, max(y)+10))abline(mod1, lwd=2)# calculate residuals and predicted valuesres pre # plot distances between points and the regression linesegments(x, y, x, pre, col="red")# add labels (res values) to pointslibrary(calibrate)textxy(x, y, res, cx=0.7)

## R is a cool image editor!

November 7, 2010
By

Here I present some functions I wrote to recreate some of the most common image effect available in all image editor.They require the library rimage.To load the image, use:y <- read.jpeg("path")To display the image, use:plot(y)Original imageSepia tonergb2sepia <- function(img){ iRed <- img*255 iGreen <- img*255 iBlue <- img*255  oRed <- iRed * .393...

## R is a cool image editor!

November 7, 2010
By

Here I present some functions I wrote to recreate some of the most common image effect available in all image editor.They require the library rimage.To load the image, use:y <- read.jpeg("path") To display the image, use:plot(y) Original image Sepia tone rgb2sepia <- function(img){ iRed <- img*255 iGreen <- img*255 iBlue <- img*255  oRed <- iRed * .393...