[R] apply and plot

Marc Schwartz (via MN) mschwartz at mn.rr.com
Thu Oct 13 18:22:15 CEST 2005


On Thu, 2005-10-13 at 14:50 +0100, Luis Ridao Cruz wrote:
> R-help,
> 
> I use the code below to plot some data by applying "apply" function.
> But I don't know how I can get the argument "type" or "col" on the
> "plot" function to distinguish the different lines
> in the graph:
> 
> apply ( my.data, 2, function ( x ) lines ( dimnames ( my.data ) [[1]] ,
> x ) )
> 
> 
> Thank you in advance


Rather than trying the use the construct above, take a look at ?matlines
and/or ?matplot (both on the same help page with ?matpoints.)

I think that you will find these purposefully designed functions better
suited to what I believe you are trying to do here.

HTH,

Marc Schwartz




More information about the R-help mailing list