Message-ID: <17EEB2B4-8889-48AD-A75C-7EDBA05E79A6@comcast.net>
Date: 2008-12-23T16:15:34Z
From: David Winsemius
Subject: How can I avoid nested 'for' loops or quicken the process?
In-Reply-To: <85f3856f0812230756p5ed4e2fcm7d6d64ed46107e7b@mail.gmail.com>
On Dec 23, 2008, at 10:56 AM, Brigid Mooney wrote:
> Thank you again for your help.
>
snip
>
> -------------
> With the 'apply' call, Results2 is of class list.
>
> Results2 <- apply(CombParam, 1, calcProfit, X, Y)
> -------------------------------------------------------------------------------------------------------
>
> How can I get convert Results2 from a list to a data frame like
> Results?
Have you tried as.data.frame() on Results2? Each of its elements
should have the proper structure.
You no longer have a reproducible example, but see this session clip:
> lairq <- apply(airquality,1, function(x) x )
> str(lairq)
num [1:6, 1:153] 41 190 7.4 67 5 1 36 118 8 72 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:6] "Ozone" "Solar.R" "Wind" "Temp" ...
..$ : NULL
> is.data.frame(lairq)
[1] FALSE
> is.data.frame(rbind(lairq))
[1] FALSE
> is.data.frame( as.data.frame(lairq) )
--
David Winsemius