On Fri, 2010-10-08 at 09:30 -0700, skan wrote: > It's a problem much bigger. > I use a matrix to store the results of a bigger problem. > I loop through several variables and store the results of a computation on > that matrix. > At the beginning of the problem I initialize the matrix to zeros and I > calculate its size from some input. > > And that seems not to work well maybe because of some rounding error.
Several people have responded with a solution to your Q on stackoverflow: matrix(0, ncota*nslope, 4) As the 0 will get recycled to appropriate length. G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% ______________________________________________ R-help@r-project.org 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.