[R] R: Why this deosn't work?, matrix, rounding error?

jim holtman jholtman at gmail.com
Fri Oct 8 17:31:18 CEST 2010


FAQ 7.31

On Fri, Oct 8, 2010 at 11:27 AM, skan <juanpide at gmail.com> wrote:
>
> Hello
>
> Why this works:
> ncota <- 1
> nslope <- 29
> resul <- matrix(rep(0,ncota*nslope*4),ncota*nslope,4)
>
>
>
> But this doesn't?
> ncota <- 1
> sini <- 0.1; sfin <- 1.5; spaso <- 0.05; nslope <- 1+((sfin-sini)/spaso)
> resul <- matrix(rep(0,ncota*nslope*4),ncota*nslope,4)
>
>
> I guess the problem is that the division gives a noninteger number.
> How can I get the second one work?
> I need to create a zero matrix with its size calculated from a calculation.
>
> cheers
> --
> View this message in context: http://r.789695.n4.nabble.com/R-Why-this-deosn-t-work-matrix-rounding-error-tp2968527p2968527.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?



More information about the R-help mailing list