Combinations

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

Combinations

Trying To learn again
Hi all,

I´ve been ill and I have lost a lot of time without seen the pc.

I want you to help if you can if you want.

Only I need an initial guide. I´ve been out a lot of time and I need a hope.
Is only for "joby" purposes.

The problem:

I want to simulate each of the posible combination in a play. Imagine they
play to games (football games) and you can choose "1", "X", "2" you must
choose this 15 times.

So finally you will get a colum 15x1 si you have (3^15) posible colums.

I want to extract all the columns were in the row 3 you can find an "2". Or
in the row 3 appears a "1" and row 3 "x".

And extract them and save in a txt document.

Sorry I know that I only ask but actually I feel very fool.

If you give an initial guide will be sufficient.

Many thanks for all in advace.

        [[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: Combinations

Arun.stat
Dear ????,

15 is very big number for me (perhaps for R as well :() so I have tried following:

mat <- expand.grid(rep(list(c("1", "X", "2")),4)); mat[mat[,3]=="2",]
Reply | Threaded
Open this post in threaded view
|

Re: Combinations

Trying To learn again
In reply to this post by Trying To learn again
Hi all,

Reading more I have find a partial solution on a part of the proble in some
part of the code it should appea something like:

# NC: All the potential combinations 3^15

if

NC[price(i,j)=="1" & price(i,j)=="2"]----> extract this column
then save all the columns that contain this pre-requisite.


2010/10/4 Trying To learn again <[hidden email]>

> Hi all,
>
> I´ve been ill and I have lost a lot of time without seen the pc.
>
> I want you to help if you can if you want.
>
> Only I need an initial guide. I´ve been out a lot of time and I need a
> hope. Is only for "joby" purposes.
>
> The problem:
>
> I want to simulate each of the posible combination in a play. Imagine they
> play to games (football games) and you can choose "1", "X", "2" you must
> choose this 15 times.
>
> So finally you will get a colum 15x1 si you have (3^15) posible colums.
>
> I want to extract all the columns were in the row 3 you can find an "2". Or
> in the row 3 appears a "1" and row 3 "x".
>
> And extract them and save in a txt document.
>
> Sorry I know that I only ask but actually I feel very fool.
>
> If you give an initial guide will be sufficient.
>
> Many thanks for all in advace.
>
>
        [[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: Combinations

Jonathan Christensen
Hi,

On Tue, Oct 5, 2010 at 3:52 AM, Trying To learn again
<[hidden email]> wrote:

>
> Hi all,
>
> Reading more I have find a partial solution on a part of the proble in some
> part of the code it should appea something like:
>
> # NC: All the potential combinations 3^15
>
> if
>
> NC[price(i,j)=="1" & price(i,j)=="2"]----> extract this column
> then save all the columns that contain this pre-requisite.

That's an empty set, so it's really easy to extract.

Try something like

NC[,(NC[3,]=="1")]

Note the commas, which control whether you are selecting rows or
columns. I recommend reading "An Introduction to R":

http://cran.r-project.org/doc/manuals/R-intro.pdf

Jonathan


>
> 2010/10/4 Trying To learn again <[hidden email]>
>
> > Hi all,
> >
> > I´ve been ill and I have lost a lot of time without seen the pc.
> >
> > I want you to help if you can if you want.
> >
> > Only I need an initial guide. I´ve been out a lot of time and I need a
> > hope. Is only for "joby" purposes.
> >
> > The problem:
> >
> > I want to simulate each of the posible combination in a play. Imagine they
> > play to games (football games) and you can choose "1", "X", "2" you must
> > choose this 15 times.
> >
> > So finally you will get a colum 15x1 si you have (3^15) posible colums.
> >
> > I want to extract all the columns were in the row 3 you can find an "2". Or
> > in the row 3 appears a "1" and row 3 "x".
> >
> > And extract them and save in a txt document.
> >
> > Sorry I know that I only ask but actually I feel very fool.
> >
> > If you give an initial guide will be sufficient.
> >
> > Many thanks for all in advace.
> >
> >
>
>        [[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.