[R] R: Why this deosn't work?, matrix, rounding error?
Gavin Simpson
gavin.simpson at ucl.ac.uk
Sat Oct 9 09:26:05 CEST 2010
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
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
More information about the R-help
mailing list