[R] list(0) to integer

Frederic renaud fren2 at yahoo.com
Mon Dec 27 12:18:53 CET 2004


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")
  }

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




More information about the R-help mailing list