Re: [R] Urgent query about R!

From: Rachel Chu <aki.rachel_at_gmail.com>
Date: Tue, 29 Mar 2011 12:58:35 +0100

Thank you everyone for all your help!! I have done and sent my coursework now. Hopefully it is alright!
R is an interesting programming language but I am happy to leave it for now ;)
Have a wonderful easter break!

Best wishes,
Rachel

2011/3/23 Jorge Ivan Velez <jorgeivanvelez_at_gmail.com>

> Hi Rachel,
>
> You might also try
>
> apply(expand.grid(rep(list(1:6), 4)), 1, paste, collapse = "", sep = "")
>
> HTH,
> Jorge
> *
>
>
> *
> On Tue, Mar 22, 2011 at 6:41 PM, Rachel Chu <> wrote:
>
>> Hi there,
>>
>> I am currently working on a R programming project and got stuck.
>> I am supposed to generate a set of possibilities of 1296 different
>> combinations of 4 numbers, ie. 1111, 1234, 2361, (only contain 1 to 6) in
>> a
>> matrix form
>> here is what I got which has not been working as it keeps coming out with
>> the same number on the row..
>>
>> The code:
>> gl1<- gl(1296,1,length=1296, labels=1:1296, ordered=true)
>> s<-matrix(gl1, nrow=1296,ncol=4)
>>
>> and i want to get a result which will provide me 1296 outcomes of
>> DIFFERENT
>> COMBINATIONS of numbers (from 1 to 6)
>> e.g.
>> [1] 1111
>> ...
>> [1295] 6665
>> [1296] 6666
>>
>> if anyone could email me back with what I am doing wrong and what I should
>> actually do i would be extremely thankful!
>> (I am doing my project and am so stressed because of getting stuck on the
>> supposedly easier problem..)
>>
>> Thanks again!
>>
>> xoxo
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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.
>>
>
>

-- 
Looking forward to your reply.

	[[alternative HTML version deleted]]

______________________________________________
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.
Received on Tue 29 Mar 2011 - 12:38:18 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Mar 2011 - 12:40:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive