PROTECTED]
Subject: Re: [R] Loop on vector name
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Date: Wednesday, September 17, 2008, 5:32 PM
you need to get(), e.g., try this:
dat1 - rnorm(5)
dat2 - rnorm(6)
dat3 - rnorm(7)
lis - lapply(paste(dat, 1:3, sep =
), get)
lis
sapply(lis, sd)
I
: [R] Loop on vector name
To: [EMAIL PROTECTED]
Date: Friday, September 19, 2008, 11:20 AM
hi: i'm not sure if i'm understanding your question
because the sapply
output is a vector. see below.
dat1 - rnorm(5)
dat2 - rnorm(6)
dat3 - rnorm(7)
lis - lapply(paste(dat, 1:3, sep =
), get
Try this:
sapply(ls(patt=^dat[0-9]), function(x)sd(get(x)))
On Wed, Sep 17, 2008 at 8:50 AM, Megh Dal [EMAIL PROTECTED] wrote:
[My previous message rejected, therefore I am sending same one with some
modification]
I have 3 vectors with object name : dat1, dat2, dat3
Now I want to create a
you need to get(), e.g., try this:
dat1 - rnorm(5)
dat2 - rnorm(6)
dat3 - rnorm(7)
lis - lapply(paste(dat, 1:3, sep = ), get)
lis
sapply(lis, sd)
I hope it helps.
Best,
Dimitris
Megh Dal wrote:
[My previous message rejected, therefore I am sending same one with some
modification]
I have
this helps,
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
project.org] On Behalf Of Megh Dal
Sent: Wednesday, September 17, 2008 5:51 AM
To: [EMAIL PROTECTED]
Subject: [R] Loop on vector name
[My previous message rejected, therefore I am sending same one
5 matches
Mail list logo