s-news
[Top] [All Lists]

Re: - Multiple Plots using By

To: Andrew Scott <andrew.scott@icfrith.com.au>
Subject: Re: - Multiple Plots using By
From: Sundar Dorai-Raj <sundar.dorai-raj@pdf.com>
Date: Wed, 12 Apr 2006 22:02:36 -0500
Cc: s-news@lists.biostat.wustl.edu
In-reply-to: <17ECC4735C623B419672DD87E7539D2B699C8C@icfmail1.icfrith.com.au>
Organization: PDF Solutions, Inc.
References: <17ECC4735C623B419672DD87E7539D2B699C8C@icfmail1.icfrith.com.au>
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Andrew Scott wrote:
Dear S-News Readers,

Is there a simple way to obtain multiple plots of 2 variables from a single dataframe according to a category variable. For example,

/by ( data.df, data.df$category, summary)/

gives a summary for each category but

/by ( data.df, data.df$category, plot (data.df$var1, data.df$var2) )/

just produces a single plot for all categories.

Any help would be appreciated.


Andrew Scott


Hi, Andrew,

I believe you want something like:

by(data.df, data.df$category, function(x) plot(x$var1, x$var2))

HTH,

--sundar

<Prev in Thread] Current Thread [Next in Thread>