and list names not available
If you must use lapply then do it over the names rather than the
data:
lapply(names(people), function(nm) plot(1:10, people[[nm]], main = nm))
On Feb 5, 2008 11:47 AM, john seers (IFR) <[EMAIL PROTECTED]> wrote:
>
>
> Hi Gabor
>
> Thanks for th
e lapply to plot the
> data (or whatever) and be able to slap a label on it so I can keep track
> of what I am doing.
>
> Regards
>
> John Seers
>
>
>
>
> -Original Message-
> From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
> Sent: 05 February 2008
plot the
data (or whatever) and be able to slap a label on it so I can keep track
of what I am doing.
Regards
John Seers
-Original Message-
From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
Sent: 05 February 2008 16:17
To: john seers (IFR)
Cc: R Help
Subject: Re: [R] Using lapply and
hits=-2.5 tests=BAYES_00,FORGED_RCVD_HELO
X-USF-Spam-Flag: NO
maybe you could use mapply(), e.g.,
people <- list(Andrew = rnorm(10), Mary = rnorm(10),
Jane = rnorm(10), Richard = rnorm(10))
doplot <- function (individual, main) {
plot(individual, main = main)
}
par(mfrow = c(2,2))
jpe
The problem is your data is in wide format and you want it in long format.
See ?reshape and also see the reshape package. In your example, ?stack
is sufficient:
library(lattice)
xyplot(values ~ seq_along(values) | ind, data = stack(people))
On Feb 5, 2008 11:05 AM, john seers (IFR) <[EMAIL PRO
5 matches
Mail list logo