On Mon, 27 Dec 2004 03:18:53 -0800 (PST) Frederic renaud <[EMAIL PROTECTED]> wrote:
> Hello > I've another question :-) > I would like to transform a list to a integer. > I must be sure that the number entered by the user is > an integer! Thus, I've made : > > > repeat{ > cat("Effectif des populations (integer):") > n<-scan("",n=1,what=list(0),quiet=TRUE) > > if (is.integer(n[[1]])==TRUE) break > print("L'effectif des population doit etre un > entier") > } if (!is.integer(unlist(n))) stop("L'effectif ...") You don't need `== TRUE' (and I guess you meant `== FALSE') An error action can be executed using stop("some error message"). `break' breaks out of the loop (ie goes to the first statement after the loop), so the print statement cannot be executed. Are you sure you need n to be a list ? HTH, Tobias > That doesn't work of course but I've no idea to do > this. How verify that n[[1]] is an integer an > transform them as an integer (as.integer(n) doesn't > work!) > Someone can help me? Thanks! > Fred > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html