Movatterモバイル変換


[0]ホーム

URL:


Recall {base}R Documentation

Recursive Calling

Description

Recall is used as a placeholder for the name of the functionin which it is called. It allows the definition of recursivefunctions which still work after being renamed, see example below.

Usage

Recall(...)

Arguments

...

all the arguments to be passed.

Note

Recall will not work correctly when passed as a functionargument, e.g. to theapply family of functions.

See Also

do.call andcall.

local for another way to write anonymous recursive functions.

Examples

## A trivial (but inefficient!) example:fib <- function(n)   if(n<=2) { if(n>=0) 1 else 0 } else Recall(n-1) + Recall(n-2)fibonacci <- fib; rm(fib)## renaming wouldn't work without Recallfibonacci(10) # 55

[Packagebase version 4.6.0Index]

[8]ページ先頭

©2009-2025 Movatter.jp