[R] Graphics function question

From: Peter Flom <peterf_at_brainscope.com>
Date: Tue, 29 Jul 2008 09:38:55 -0700


Hello

I have created a graph using the following commands:

<<<
startBReP3O1T <- diffs$BReP3O1T - diffs$diff_BReP3O1T endBReP3O1T <- diffs$BReP3O1T

x <- seq(47,89, length = 10)
ymin <- min(min(startBReP3O1T), min(endBReP3O1T)) ymax <- max(max(startBReP3O1T), max(endBReP3O1T)) y <- seq(ymin, ymax, length = 10)
plot(x,y, type = 'n', xlab = 'Age', ylab = 'BReP3O1T', main = 'Age, decline and BReP3O1T') segments(x0 = startage, x1 = endage, y0 = startBReP3O1T, y1 = endBReP3O1T, col = decline) legend('topleft', legend = c('Stable', 'Decline'), lty = 1, col = c(1,2))
>>>>>

I would like to make this into a function. The only thing that changes is BReP3O1T. The problem is that sometimes this occurs as text (e.g. in ylab and main) sometimes after a $ (e.g. in the first two assigment statements), and sometimes it refers to the values (e.g. in ymin and ymax)

Any help appreciated.

Peter

Peter L. Flom, PhD
Brainscope, Inc.

212 263 7863 (MTW)
212 845 4485 (Th)
917 488 7176 (F)



	[[alternative HTML version deleted]]

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 29 Jul 2008 - 16:44:36 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Jul 2008 - 18:32:51 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive