countdown <- function(from)
{
  print(from)
  while(from!=0)
  {
    Sys.sleep(1)
    from <- from - 1
    print(from)
  }
}

countdown(5)
> countdown(5)
[1] 5
[1] 4
[1] 3
[1] 2
[1] 1
[1] 0

While loops

Use while(condition){code}.

Logical operators

You can use the usual C-style operators: ==,<,||,&&,....
However, there are differences under some circumstances.

Sys.sleep

Suspends execution for the given amount of seconds.