[R] Sequence generation in a table

2010-12-09 Thread Vincy Pyne
Dear R helpers I have following input f = c(257, 520, 110). I need to generate a decreasing sequence (decreasing by 100) which will give me an input (in a tabular form) like 257, 157, 57 520, 420, 320, 220, 120, 20 110, 10 I tried the following R code f = c(257, 520, 110) yy =

Re: [R] Sequence generation in a table

2010-12-09 Thread Jan van der Laan
Vincy, I suppose the following does what you want. yy is now a list which allows for differing lengths of the vectors. yy - lapply(c(257, 520, 110), seq, to=0, by=-100) yy[[1]] [1] 257 157 57 yy[[2]] [1] 520 420 320 220 120 20 Regards, Jan On 9-12-2010 11:40, Vincy Pyne wrote:

Re: [R] Sequence generation in a table

2010-12-09 Thread Vincy Pyne
and hope I am able to put up my problem in a proper manner. Regards Vincy Pyne --- On Thu, 12/9/10, Jan van der Laan rh...@eoos.dds.nl wrote: From: Jan van der Laan rh...@eoos.dds.nl Subject: Re: [R] Sequence generation in a table To: r-help@r-project.org, vincy_p...@yahoo.ca Received

Re: [R] Sequence generation in a table

2010-12-09 Thread Liviu Andronic
On Thu, Dec 9, 2010 at 12:41 PM, Vincy Pyne vincy_p...@yahoo.ca wrote: The biggest constraint for me is here as an example I have taken only three cases i.e. c(257, 520, 110), however in reality I will be dealing with no of cases and that number is unknown. But your code will certainly

Re: [R] Sequence generation in a table

2010-12-09 Thread Petr PIKAL
] Sequence generation in a table To: r-help@r-project.org, vincy_p...@yahoo.ca Received: Thursday, December 9, 2010, 10:57 AM Vincy, I suppose the following does what you want. yy is now a list which allows for differing lengths of the vectors. yy - lapply(c(257, 520, 110), seq, to=0, by=-100

Re: [R] Sequence generation in a table

2010-12-09 Thread Vincy Pyne
PIKAL petr.pi...@precheza.cz wrote: From: Petr PIKAL petr.pi...@precheza.cz Subject: Re: [R] Sequence generation in a table To: Vincy Pyne vincy_p...@yahoo.ca Cc: r-help@r-project.org Received: Thursday, December 9, 2010, 12:03 PM Hi r-help-boun...@r-project.org napsal dne 09.12.2010 12:41:47

Re: [R] Sequence generation in a table

2010-12-09 Thread Liviu Andronic
On Thu, Dec 9, 2010 at 1:24 PM, Vincy Pyne vincy_p...@yahoo.ca wrote: yy - lapply(c(257, 520, 110), seq, to=0, by=-100) yy/360, I get following error. Error in yy/360 : non-numeric argument to binary operator On the other hand, yy[[1]]/365  fetches me [1] 0.7138889 0.436

Re: [R] Sequence generation in a table

2010-12-09 Thread Henrique Dallazuanna
for the inconvenience caused. I tried to keep my problem short in oder not to consume your valuable time. Regards Vince Pyne --- On Thu, 12/9/10, Petr PIKAL petr.pi...@precheza.cz wrote: From: Petr PIKAL petr.pi...@precheza.cz Subject: Re: [R] Sequence generation in a table To: Vincy Pyne

Re: [R] Sequence generation in a table

2010-12-09 Thread Petr PIKAL
petr.pi...@precheza.cz Subject: Re: [R] Sequence generation in a table To: Vincy Pyne vincy_p...@yahoo.ca Cc: r-help@r-project.org Received: Thursday, December 9, 2010, 12:03 PM Hi r-help-boun...@r-project.org napsal dne 09.12.2010 12:41:47: Dear Sir, Sorry to bother you again. Sir

Re: [R] Sequence generation

2009-08-31 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 29.08.2009 21:49:54: On Sat, Aug 29, 2009 at 8:14 PM, njhuang86njhuan...@yahoo.com wrote: Hey guys, I was wondering how to create this sequence: 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3... with the '1, 2, 3' repeated over 10 times. rep(1:3,10)

[R] Sequence generation

2009-08-29 Thread njhuang86
Hey guys, I was wondering how to create this sequence: 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3... with the '1, 2, 3' repeated over 10 times. Also, is there a simple method to generate 1, 1, 1, 2, 2, 2, 3, 3, 3? Anyways, any help with be greatly appreciated! -- View this message in context:

Re: [R] Sequence generation

2009-08-29 Thread RIOS,ALFREDO ARTURO
I think should work rep(c(1,2,3),10) Alfredo On Sat Aug 29 15:14:15 EDT 2009, njhuang86 njhuan...@yahoo.com wrote: Hey guys, I was wondering how to create this sequence: 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3... with the '1, 2, 3' repeated over 10 times. Also, is there a simple method

Re: [R] Sequence generation

2009-08-29 Thread David Winsemius
On Aug 29, 2009, at 3:14 PM, njhuang86 wrote: Hey guys, I was wondering how to create this sequence: 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3... with the '1, 2, 3' repeated over 10 times. As noted earlier rep(1:3, 10) Also, is there a simple method to generate 1, 1, 1, 2, 2, 2, 3, 3, 3?

Re: [R] Sequence generation

2009-08-29 Thread Barry Rowlingson
On Sat, Aug 29, 2009 at 8:14 PM, njhuang86njhuan...@yahoo.com wrote: Hey guys, I was wondering how to create this sequence: 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3... with the '1, 2, 3' repeated over 10 times. rep(1:3,10) # rep repeats its first argument according to the number in its second

Re: [R] Sequence generation

2009-08-29 Thread Greg Snow
: Saturday, August 29, 2009 1:50 PM To: njhuang86 Cc: r-help@r-project.org Subject: Re: [R] Sequence generation On Sat, Aug 29, 2009 at 8:14 PM, njhuang86njhuan...@yahoo.com wrote: Hey guys, I was wondering how to create this sequence: 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3