[R] Re place values matrix

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Nov 18 18:54:56 CET 2008


 From ?"[":

"When indexing arrays by [ a single argument i can be a matrix with as 
many columns as there are dimensions of x"

Uwe Ligges




start wrote:
> To replace particular values in a matrix we can use the following command.
> 
> matrix[x,y] = value
> 
> But what to do if I have a list of +- 1,000,000 values and associated x,y
> values.
> Is there an efficient way to replace my matrix with those values.
> 
> My first idea was to replace x, y and values by vectors.......but that
> doesn't work.
> Value in this case can't be a vector :(. It results in a wrong replacement.
> It takes the last value of the matrix.........
> 
>



More information about the R-help mailing list