G. Sawitzki        StatLab Heidelberg Last revision: 2013-06-04 by gs
StatLab Heidelberg  > projectsrqa

R Questions and Answers, and Recipes

  1. Questions and Answers, and Recipes
    1. Graphics
    2. Contact


CRAN
R-Forge


CRAN Search



CRAN Task Views




This is an ad hoc collection, possibly growing. Started: Nov. 18, 2012. Last revision date: see above.

Graphics

Q. How do I get common scales for plots to keep them comparable?
A. The high level plotting function set the axis and scales. By default, these adapt to the data. They can be controlled using function arguments, as in
plot(x, y, xlim = c(0, 100), ylim=  c(0,1)). Direction is respected, so ylim=  c(1,0) will give a y-axis pointing down. You get logarithmic scales using a  parameter log = "x", for example. These arguments are documents in help(plot.default).

To get a new plot window with scales set to your choice, use plot.window(). If you have set up the plot yourself, low level plot functions will add to this plot. For high level functions, you have to call them with new=TRUE to mark that the setup has already been done.

Q. How do I draw error bars?
A. Use this code snippet: arrows(x,y+up, x, y-ldown, angle=90, code=3, length=length, ...). The length controls the width of the bar mark. You may want to introduce a function errbar() or modify dots() to your preferences.

Strings

Q. Where do I find information about string handling in R?
A. See  R programming Wikibook section on "Text Processing" or the CRAN task view "Natural Language Processing".

Misc

Q: How do I find the number of TRUEs in a logical vector v?
A: Use sum(v). TRUE is converted to 1 when numeric values are required.




Contact


email
gs@statlab.uni-heidelberg.de

home page
www.statlab.uni-heidelberg.de/users/gs/
PGP key
SHA-1 fingerprint: D352 E1AA 12F0 57D4 6C7A B13B 4393 FCF8 BCE6 1251
X.509 key

Tel
+ 49 (0) 62 21 - 54 89 79
Fax
+ 49 (0) 62 21 - 54 53 31
Mail
Günther Sawitzki

Statistisches Labor

Institut für Angewandte Mathematik
Im Neuenheimer Feld 294
D 69120 Heidelberg

Travel
see map.

$Source: /u/math/sa3/cvswww/www/www.statlab.uni-heidelberg.de/projects/r/qa.html,v $
$Revision: 1.4 $
$Date: 2013/06/04 21:57:15 $