[R] A question about plots and lists in functions

From: Jason Q McClintic <jqmcclintic_at_stthomas.edu>
Date: Tue, 19 Jun 2007 15:02:08 -0500


R-helpers:

I tried googling and couldn't find anything.

I have a function I am sourcing into R that does some calculations to generate a simulated dataset. I currently have a a list set up to store the outputs from the function and a plot of one of them (a set of ordered pairs) like this:

foo<-function(x,y,z){
## do some work here ##
list(x=x,y=y,z=z,output1=output1,output2=output2,

     plot=plot(output1[,1],output1[,2],type=p)); }

The problem I am having is that when I do

>work<-foo(x,y,z)
>work

it will show the plot, but I would like to be able to repeatedly call it like I can call the different plots in an lm without having to display everything else too (in some cases, output1 could be a 50K by 2 matrix, rather inconvenient to keep having it display that over and over again to get a graph).

Thanks in advance,

Jason Q. McClintic

--
Jason Q McClintic
jqmcclintic_at_stthomas.edu
mccl0219_at_tc.umn.edu

______________________________________________
R-help_at_stat.math.ethz.ch 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 19 Jun 2007 - 20:07:09 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 19 Jun 2007 - 20:33:57 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.