"A big computer, a complex algorithm and a long time does not equal science." -- Robert Gentleman
venerdì 29 maggio 2009
lunedì 11 maggio 2009
vim plugin for R
For the vim/R-addicted a must to have:
http://www.vim.org/scripts/script.php?script_id=2628
http://www.vim.org/scripts/script.php?script_id=2628
venerdì 8 maggio 2009
Searching through mailing list archives
Romain Francois on his blog posted a very useful function to search through the R mailing list archives. Take a look at it here. Take also a look at the tm package introduced in R News, 8(2):19–22, Oct. 2008 with an example dealing with analysis of the R-help mailing list.
mercoledì 29 aprile 2009
screen in ubuntu 9.04
martedì 28 aprile 2009
Tips from the R-help list : shadow text in a plot and bumps charts
Stumbling across the R-help mailing-list I found, as often happens, two threads in the spirit of this blog (of course, since they come from the list, the quality is higher): here you can find a function allowing a shadow outline style for a text in a plot. From here you can follow an interesting thread depicting how to produce bumps charts in R.
venerdì 24 aprile 2009
Colors in the R terminal
martedì 31 marzo 2009
Multiple plot in a single image using ImageMagick
Sometimes you need to add several plots/images either by row or by column to a single page/sheet.
If you generate all your plot with R base graphics you can easily accomplished the task using the par() function, e.g., using par(mfrow=c(2,2)) and then drawing 4 plots of your choice.
However, if you need to create a single image build up from different sources, e.g. external images, plots not compatible with R base graphics, etc. , you can create/retrieve the single images and then merge them together using the tools from the Unix (Linux, Mac OS X, etc.) ImageMagick suite.
Then you can type:
Remember that in R you have to start escape character with '\' !
Or, alternatively, from the command line:
See man convert and man ImageMagick for the full story.
If you generate all your plot with R base graphics you can easily accomplished the task using the par() function, e.g., using par(mfrow=c(2,2)) and then drawing 4 plots of your choice.
However, if you need to create a single image build up from different sources, e.g. external images, plots not compatible with R base graphics, etc. , you can create/retrieve the single images and then merge them together using the tools from the Unix (Linux, Mac OS X, etc.) ImageMagick suite.
## Example
# we generate some random plot
require(seqLog)
## the first plot is taken from the seqLogo help ( ?seqLogo )
## I selected this example on purpose because the seqLogo function is based on the grid graphics
and is coded in such a way that doesn't allow the use of the par() function
mFile <- system.file("Exfiles/pwm1", package="seqLogo")
m <- read.table(mFile)
pwm <- makePWM(m)
png("seqLogo1.png", width=400, height=400)
seqLogo(pwm)
dev.off()
## totally unrelated
png("plot1.png", width=400, height=400)
plot(density(rnorm(1000)))
dev.off()Then you can type:
system("convert \\( seqLogo1.png plot1.png +append \\) \\( seqLogo1.png plot1.png +append \\) -background none -append final.png")Remember that in R you have to start escape character with '\' !
Or, alternatively, from the command line:
convert \( seqLogo1.png plot1.png +append \) \( seqLogo1.png plot1.png +append \) -background none -append final.png
See man convert and man ImageMagick for the full story.
Iscriviti a:
Commenti (Atom)
