| To: | "eugene dalt" <eugenedalt@yahoo.com> |
|---|---|
| Subject: | Re: lapply? |
| From: | Daniel_J_Celta@fpl.com |
| Date: | Sat, 19 Aug 2006 15:10:05 -0400 |
| Cc: | r-help@stat.math.ethz.ch, s-news@lists.biostat.wustl.edu, s-news-owner@lists.biostat.wustl.edu |
Eugene,
Try
> lapply(c(4,6,7,8), function(x) rep(5, x))
I think this would do what you are trying to do.
Daniel J Celta
Project Valuation - Special Valuations
561 691 7653
"eugene dalt"
<eugenedalt@yahoo.com> To:
s-news@lists.biostat.wustl.edu, r-help@stat.math.ethz.ch
Sent by: cc:
s-news-owner@lists.biosta Subject: [S] lapply?
t.wustl.edu
08/19/2006 10:01 AM
Hi folks,
I would like to know if the following loop can be
rewritten with lapply
list1 <- as.list(0)
testv <- c(4,6,7,8)
for( i in 1:4){
list1[[i]] <- rep(5,testv[i])
}
Thanks in Advance. - Eugene
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | lapply?, eugene dalt |
|---|---|
| Next by Date: | calculating upper and lower CL using lme and glme, Nicola Koper |
| Previous by Thread: | Origin for dates, David Huffer |
| Next by Thread: | calculating upper and lower CL using lme and glme, Nicola Koper |
| Indexes: | [Date] [Thread] [Top] [All Lists] |