Re: [R] multiple graphs, lapply and different titles

2012-10-19 Thread David Winsemius

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

__
R-help@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.


[R] multiple graphs, lapply and different titles

2012-10-19 Thread Flavio Barros
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?

-- 
Att,

Flávio Barros

[[alternative HTML version deleted]]

__
R-help@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.