[R] strange error message
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 WC ASMR SMR AF U [1,] 9.20 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] strange error message
Michael Rennie [EMAIL PROTECTED] writes: + } 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 = ) So what were the warnings? We can figure out what the warnings function looks like without your help (Read the message *carefully*!) -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] strange error message
Michael 1) Those are not errors, but warnings. You need to use warnings() (with the brackets) to see what they were. By typing warnings (without the brackets) you are asking R to print out the source code for the warnings() function. 2) try ?options and see option digits in that help file Hope that helps a bit, Gavin Michael Rennie wrote: 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 WC ASMR SMR AF U [1,] 9.20 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? -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [T] +44 (0)20 7679 5522 ENSIS Research Fellow [F] +44 (0)20 7679 7565 ENSIS Ltd. ECRC [E] [EMAIL PROTECTED] UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/ 26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/ London. WC1H 0AP. %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help