Skip to content
Prev 171673 / 398506 Next

Have a function like the "_n_" in R ? (Automatic count function )

hadley wickham wrote:
actually, you do not need the external function to have the functionality:

    n = local({
        i = 0
        function() (i <<- i + 1)[1] })

    n()
    # 1
    n()
    # 2

vQ