Robin Hankin wrote:

> The error is given because after B[[1]] <- a,   the variable B is  
> just a scalar and
> not a matrix (why is this?)
> 

  Because [[i]] indexes more general vectors, and if you do B[[1]] when 
B is NULL, R doesnt know if you want B to be a list or a simple vector.

  If you initialise B as an empty list then R knows:

  > B=list()
  > B
  list()
  > B[[1]]=b
  > B
  [[1]]
       [,1]
  [1,]    1

Barry

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to