)]])
~~
Stu Field, PhD
Postdoctoral Fellow
Department of Biology
Colorado State University
1878 Campus Delivery
Fort Collins, CO 80523-1878
Office: E208 Anatomy/Zoology
Phone: (970) 491-5744
~~
[[alternative HTML version deleted
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/
~~
Stu Field, PhD
Postdoctoral Fellow
Department of Biology
Colorado State University
1878 Campus Delivery
Fort Collins, CO 80523-1878
Office: E208
there is not a simple way to do this...
Thanks for your help,
~~
Stu Field, PhD
Postdoctoral Fellow
Department of Biology
Colorado State University
1878 Campus Delivery
Fort Collins, CO 80523-1878
Office: E208 Anatomy/Zoology
Phone: (970) 491-5744
(A) == col(A) + 1] - vec
--sundar
On Wed, Mar 11, 2009 at 4:42 PM, Stu Field s...@colostate.edu wrote:
I'm trying to enter a vector into the subdiagonal of a matrix but
cannot find a command in R which corresponds to the MatLab version of
diag(vec, k), where vec = the vector of interest
] On Behalf Of Sundar Dorai-Raj
Sent: Thursday, 12 March 2009 10:00 AM
To: Stu Field
Cc: r-help@r-project.org
Subject: Re: [R] Matrix Construction; Subdiagonal
You can always write your own function:
myDiag - function(x, vec, k) {
x[row(x) == col(x) - k] - vec
x
}
myDiag(A, vec, -1
5 matches
Mail list logo