[R] fill up a matrix

Luis Rideau Cruz Luisr at frs.fo
Thu Apr 22 14:00:04 CEST 2004


Hi all,

I want to fill in this matrix vectors (by column) without overwriting the first elements in column 1995.

Is there any other way than concatenate the first element with the vector and then assign this new vector 
to the column in matrix?   

 matrix[,"3"]<-c(1591,"vector")
 matrix[,"4"]<-c(405,"vector")
...
...

                               matrix
             2     3     4      5     6   7    8    9   10
1995  278 1591 405 482 285 99 220 48  4
1996 1220   NA  NA  NA  NA NA  NA NA NA
1997 3106   NA  NA  NA  NA NA  NA NA NA
1998 1895   NA  NA  NA  NA NA  NA NA NA
1999 1376   NA  NA  NA  NA NA  NA NA NA
2000  565   NA  NA  NA  NA NA  NA NA NA
2001  491   NA  NA  NA  NA NA  NA NA NA
2002 1169   NA  NA  NA  NA NA  NA NA NA
2003 2310   NA  NA  NA  NA NA  NA NA NA


Luis Ridao Cruz
Fiskirannsóknarstovan
Nóatún 1
P.O. Box 3051
FR-110 Tórshavn
Faroe Islands
Phone:             +298 353900
Phone(direct): +298 353912
Mobile:             +298 580800
Fax:                 +298 353901
E-mail:              luisr at frs.fo
Web:                www.frs.fo




More information about the R-help mailing list