Learn R Programming

TurtleGraphics (version 1.0-8)

turtle_do: Evaluate a Larger Portion of Turtle Drawing Code

Description

turtle_do evaluates an R expression with the Turtle temporarily hidden (for performance reasons).

Usage

turtle_do(expr)

Arguments

expr

expression to evaluate

Details

The terrarium must be initialized prior to using these functions, see turtle_init.

In order to decrease the evaluation time of expr, it is evaluated with Turtle temporarily hidden. Basically it means that if a Turtle image is visible (see turtle_show and turtle_hide) turtle_do removes it, evaluates expr and redraws it on the function exit.

See Also

Other TurtleGraphics: TurtleGraphics-package, turtle_getpos, turtle_goto, turtle_init, turtle_move, turtle_param, turtle_reset, turtle_show, turtle_status, turtle_turn, turtle_up

Examples

Run this code
# NOT RUN {
turtle_init()
turtle_do({
   for (i in 1:4) {
      turtle_forward(50)
      turtle_right(90)
   }
})

# }

Run the code above in your browser using DataLab