Can I define a object array in R?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Can I define a object array in R?

cuiyan
Here is my problem,
100 decision trees were built(similar to random forest) and I want to replace some of them by new trees.
How can I define a tree array including 100 trees, i.e. t[100], and every t[n] is an "C5.0" object,
such that
when a new tree comes,  i can do
n<-10
t[n]<-C5.0(...)
Reply | Threaded
Open this post in threaded view
|

Re: Can I define a object array in R?

Sarah Goslee
In R, lists are used for that. See ?list or any intro to R for details.

Sarah

On Tuesday, January 29, 2013, cuiyan wrote:

> Here is my problem,
> 100 decision trees were built(similar to random forest) and I want to
> replace some of them by new trees.
> How can I define a tree array including 100 trees, i.e. t[100], and every
> t[n] is an "C5.0" object,
> such that
> when a new tree comes,  i can do
> n<-10
> t[n]<-C5.0(...)
>
>
>
>

--
Sarah Goslee
http://www.stringpage.com
http://www.sarahgoslee.com
http://www.functionaldiversity.org

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Can I define a object array in R?

Suzen, Mehmet
Hello Sarah,

You may want to use a package instead of trying to implement those
data structures. For example:
http://www.bioconductor.org/packages/release/bioc/html/graph.html

Best,
-m

On 29 January 2013 11:22, Sarah Goslee <[hidden email]> wrote:

> In R, lists are used for that. See ?list or any intro to R for details.
>
> Sarah
>
> On Tuesday, January 29, 2013, cuiyan wrote:
>
>> Here is my problem,
>> 100 decision trees were built(similar to random forest) and I want to
>> replace some of them by new trees.
>> How can I define a tree array including 100 trees, i.e. t[100], and every
>> t[n] is an "C5.0" object,
>> such that
>> when a new tree comes,  i can do
>> n<-10
>> t[n]<-C5.0(...)
>>
>>
>>
>>
>
> --
> Sarah Goslee
> http://www.stringpage.com
> http://www.sarahgoslee.com
> http://www.functionaldiversity.org
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Can I define a object array in R?

Rui Barradas
In reply to this post by cuiyan
Hello,

You can store any kind of objects in a list. More or less like the
following.

tlist <- vector("list", 100)

n <- 10
tlist[[n]] <- C5.0(...)


Hope this helps,

Rui Barradas

Em 29-01-2013 07:01, cuiyan escreveu:

> Here is my problem,
> 100 decision trees were built(similar to random forest) and I want to
> replace some of them by new trees.
> How can I define a tree array including 100 trees, i.e. t[100], and every
> t[n] is an "C5.0" object,
> such that
> when a new tree comes,  i can do
> n<-10
> t[n]<-C5.0(...)
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Can-I-define-a-object-array-in-R-tp4656909.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.