[R] Build a dataframe row by row?
Noah Silverman
noah at smartmediacorp.com
Wed Aug 5 02:01:11 CEST 2009
Hi,
Nice, but I need a few columns for the data. Don't know how to do this
with the method you suggest.
-N
On 8/4/09 4:57 PM, Remko Duursma wrote:
> Hi Noah,
>
> there are a few ways to do this. Easiest is to keep adding an element
> to a list, and then make it into a dataframe at the end, like this:
>
> resultlis<- list()
> for(i in 1:10){
>
> # your calculations here
> datavec<- runif(3)
>
> resultlis[[i]]<- datavec
>
> }
> resultdfr<- as.data.frame(do.call("rbind", resultlis))
>
>
> greetings,
> Remko
>
> -------------------------------------------------
> Remko Duursma
> Post-Doctoral Fellow
>
> Centre for Plants and the Environment
> University of Western Sydney
> Hawkesbury Campus
> Richmond NSW 2753
>
> Dept of Biological Science
> Macquarie University
> North Ryde NSW 2109
> Australia
>
> Mobile: +61 (0)422 096908
> www.remkoduursma.com
>
>
>
> On Wed, Aug 5, 2009 at 9:41 AM, Noah Silverman<noah at smartmediacorp.com> wrote:
>
>> Hi,
>>
>> Time for another of my "newbie" questions.
>>
>> Is it possible to build up a data.frame "row by row" as I go
>>
>> I'm going to be running a bunch of experiments (many in a loop) to test
>> different things. I'm using AUC as my main performance measure.
>>
>> My thought was to add a row to a data.frame for each iteration and then have
>> a nice summary report at the end.
>>
>> I found how to import, export, and create from vectors. I haven't been able
>> to find how just make an empty one and add rows as I go.
>>
>> ______________________________________________
>> R-help at 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.
>>
>>
More information about the R-help
mailing list