leur site web ggplot2 opts list
https://github.com/hadley/ggplot2/wiki/%2Bopts%28%29-List
leur site web ggplot2 opts list
https://github.com/hadley/ggplot2/wiki/%2Bopts%28%29-List
Sometimes R gives the error message.
Error in X11(d$display, d$width, d$height, d$pointsize, d$gamma, d$colortype, : unable to start device X11cairo
Here is the fix.
Sys.setenv("DISPLAY"=":0.0")
Display file contents with file names;
tail +1 many_files*
It works on Mac, BSD.
For GNU tail, use
tail -n +1 many_files*
http://stackoverflow.com/questions/5917413/cat-multiple-files-but-include-filename-as-headers
Using discontinuous axis or “breaks” may not be a good idea to visualize data.
Instead, use two plots, one with the whole data and another for zoomed data.
However, if the situation is not allowed, there is an R package to do it.
The package plotrix can put breaks or gaps on the axes.
How to use eval()?
Here is an example.
test.dframe <- data.frame(x = 1:10, y = rnorm(10)) addSmooth <- function(data, smooth = TRUE) { require(ggplot2) p <- "ggplot(data = data, aes(x = x, y = y))" p.line <- "geom_line()" p.smooth <- "stat_smooth()" if (smooth == TRUE) { p.all <- paste(p, p.line, p.smooth, sep = " + ") } else { p.all <- paste(p, p.line, sep = " + ") }. eval(parse(text = p.all)) } addSmooth(test.dframe, smooth = FALSE)
checkUsage() in the codetools package examines the function and report possible problems.
R functions look for a global variable if the variable is not found in the scope. If a function accidentally has an “orphan” variable which is not passed on to the function but has the same name as one of the global variables, the function will use the value of the global variable. It is a hard to find bug. checkUsage() will find such cases and report.
Multiple plots with different titles using ggplot, lapply, and do.call.
parameters = data.frame(p1=letters[1:5], p2=round(rnorm(5),2)) l = replicate(5, data.frame(x=1:10, y=rnorm(10)), simplify=FALSE) names(l) = do.call(paste, c(parameters, sep=",")) plot_one = function(x) ggplot(data = l[[x]]) + geom_path(aes(x, y)) + opts(title = x) plots = lapply(names(l), plot_one) do.call(gridExtra::grid.arrange, plots)
Created by Pretty R at inside-R.org
http://stackoverflow.com/questions/10726470/ggplot-over-many-data-frames-changing-titles
Defining Macros on the Command Line
Macros can be defined on the Make command line. For example:
make CFLAGS=–ms
would start up Make and define the macro CFLAGS with the value “–ms”. Macros defined on the command line take precedence over macros of the same name defined in the makefile.
If a command-line macro contains spaces, it must be enclosed in double quotes as in:
make “CFLAGS=-ms -z -p”
http://www.opussoftware.com/tutorial/TutMakefile.htm
Side by side comparison between ggplot2 and lattice
http://learnr.wordpress.com/tag/ggplot2/
Code examples and plot output
http://wiki.stdout.org/rcookbook/Graphs/
And of course,
http://had.co.nz/ggplot2/