3 回答

TA贡献2003条经验 获得超2个赞
<<-
power
square
cube
power <- function(exponent) { function(x) x ^ exponent}square <- power(2)square(2) # -> [1] 4square(4) # -> [1] 16cube <- power(3)cube(2) # -> [1] 8cube(4) # -> [1] 64
<<-
<-
new_counter
i
new_counter <- function() { i <- 0 function() { # do something useful, then ... i <<- i + 1 i }}
counter_one
counter_two
counter_one <- new_counter()counter_two <- new_counter()counter_one() # -> [1] 1counter_one() # -> [1] 2counter_two() # -> [1] 1

TA贡献2021条经验 获得超8个赞
<<-
assign
inherits
TRUE
assign
assign
<<-
<<-
assign(x, value, inherits=TRUE)
search
).
apply
<<-
- 3 回答
- 0 关注
- 639 浏览
添加回答
举报