[R] How to assigen column of matrix

John Fox jfox at mcmaster.ca
Mon Apr 21 17:47:06 CEST 2003

Dear Minghua Yao,

Commands of the form AA[, i] <- A do indeed work, although the number of 
elements in the i-th row of AA has to be a multiple of the number of 
elements in A. Perhaps you can specify in more detail what it is that you 
want to do and the nature of the error that you encountered.

I hope that this helps,

At 10:00 AM 4/21/2003 -0500, Minghua Yao wrote:

>A simple question.
>I want to assign values to columns (or rows) of a matrix.
>It seems that
>AA[,i]<-A; # A is a vector or array;
>doesn't work.
>How can I accomplish that?
>Thanks alot.

John Fox
Department of Sociology
McMaster University
email: jfox at mcmaster.ca
web: http://www.socsci.mcmaster.ca/jfox

More information about the R-help mailing list