Message-ID: <CEC72D60-94C7-4F92-8FBA-364676F18EF2@comcast.net>
Date: 2012-10-19T21:33:58Z
From: David Winsemius
Subject: multiple graphs, lapply and different titles
In-Reply-To: <CAOKagtMTX5SZSans36i_5sSzqhzDx-b_YSSsYjhDGYa3MnuTog@mail.gmail.com>
On Oct 19, 2012, at 12:30 PM, Flavio Barros wrote:
> I have a list of data.frames, and i want to iterate over this list and
> generate graphs with the same title of the data.frame.
>
> I did the graphs with:
>
> lapply(anual, function(x) plot(x[,'chuva'], type='l', xlab= 'anos', ylab =
> 'Precicipata??o(mm)', col='red'))
>
> where anual is list of data.frames. I am plotting just the column "chuva"
> at each data.frame.
>
> How can i do that?
Easiest way would be to iterate over the names of the list 'anual' and then use nam as your formal argument, pull each data.frame in from 'anual' with anual[nam] and use main=nam in the plot command.
> and provide commented, minimal, self-contained, reproducible code.
Had you provided a self-contained example I would have offered tested code in return.
--
David Winsemius, MD
Alameda, CA, USA