[R] creating series of vectors

Nino Pierantonio nino.p.80 at gmail.com
Thu Feb 16 17:32:15 CET 2012


Dear All,

I am pretty new to R and thus my question may sound silly.

Is there a way to automatically generate a series of separate vectors 
(so not arranged in a matrix), without typing and changing every time 
the values, and store them as separate *xlsx file, where the "*" is 
replaced by the name of the vector itself?

What i would like to create is a total of 12 vectors, corresponding to 
the 12 months (January to December), say for the year 2006; thus the 
name of a resulting single vector should be something like 
"January2006", and the final file that will be stored in my WD should 
have the same name ("January2009.xlsx").

The number of the elements of each vector must correspond to the length 
in days of the single months (considering a non-leap-year, 356 days) 
multiplied by 2 (e.g. "January2006" will have 31*2=62 elements, 
"February2006" will have 28*2=56 elements, and so on).

Finally, the elements of the vectors should be named as: 
"010106_aaa","010106_bbb","020106_aaa","020106_bbb", ... , 
"310106_aaa","310106_bbb".

To sum up, at the end of the process i would like to obtain 12 vectors 
as it follows:

Jauary2006("010106_aaa","010106_bbb","020106_aaa","020106_bbb", ... , 
"310106_aaa","310106_bbb")
.
.
.
.
.
December2006("010106_aaa","010106_bbb","020106_aaa","020106_bbb", ... , 
"310106_aaa","310106_bbb")

Any help would be particularly welcome and appreciated.
Cheers,

NP

  * Italiano - rilevata
  * Inglese
  * Italiano
  * Francese
  * Spagnolo
  * Tedesco

  * Inglese
  * Italiano
  * Francese
  * Spagnolo
  * Tedesco

  <javascript:void(0);>



More information about the R-help mailing list