# [R] strange error message

Michael Rennie mrennie at utm.utoronto.ca
Tue Jul 1 19:03:18 CEST 2003

```Hi, there

I have a loop that is producing data, but is also generating an error message
that I can't understand.

Here's the loop and the error message:

> bio<-matrix(NA, ncol=9, nrow=366)
> W<-NULL
> M<- length(Day) #number of days iterated
>
> for (i in 1:M)
+ {
+
+
+ if (Day[i]==1) W[i] <- Wo else W[i] <- (W[i-1]+(Gr[i]/Ef))
+
+
+ C<- p*CA*(W^CB)*(((comp[,3])^Xc)*(exp(Xc*(1-(comp[,3])))))*Pc
+
+ ASMR<- ACT*RA*(W^RB)*(((comp[,4])^Xa)*(exp(Xa*(1-(comp[,4])))))
+
+ SMR<- (ASMR/ACT)
+
+ A<- (ASMR-SMR)
+
+ F<- (FA*((comp[,2])^FB)*(exp(FG*p))*C)
+
+ U<- (UA*((comp[,2])^UB)*(exp(UG*p))*(C-F))
+
+ SDA<- (S*(C-F))
+
+ Gr<- (C-(ASMR+F+U+SDA))
+
+ bio<- cbind(W, C, ASMR, SMR, A, F, U, SDA, Gr)
+
+ }
There were 50 or more warnings (use warnings() to see the first 50)
>
> warnings
function (...)
{
if (!(n <- length(last.warning)))
return()
names <- names(last.warning)
cat("Warning message", if (n > 1)
"s", ":\n", sep = "")
for (i in 1:n) {
out <- if (n == 1)
names[i]
else paste(i, ": ", names[i], sep = "")
if (length(last.warning[[i]])) {
temp <- deparse(last.warning[[i]])
out <- paste(out, "in:", temp[1], if (length(temp) >
1)
" ...")
}
cat(out, ..., fill = TRUE)
}
}
>
> dimnames (bio) <-list(NULL, c
("W", "C", "ASMR", "SMR", "A", "F", "U", "SDA", "Gr"))
>
>
> bio
W        C     ASMR       SMR         A        F         U
[1,]  9.200000 233.6647 107.5640  64.50050  43.06345 31.93755 15.840142

Also, does anyone know why I might be getting differences in the same
calculation between R and Excel?  Is there any way to keep R from rounding your
numbers, or to specify the # of decimal places you want for an element?

--
Michael Rennie
M.Sc. Candidate
University of Toronto at Mississauga
3359 Mississauga Rd. N.
Mississauga ON  L5L 1C6
Ph: 905-828-5452  Fax: 905-828-3792

```