Skip to content
Prev 241045 / 398500 Next

Simple Function

If you want to assign to a variable in your workspace, rather than a
local variable in your function, you can use the <<- operator (double
headed arrow) like this...

mat <- function(i) {
  for (k in i:10) {
    y[k] <<- k+1
    f[k] <<- y[k-1] / 2
  }
}

Type ?"<<-" for the help page.

Michael
On 10 November 2010 18:09, rnick <nikos.rachmanis at gmail.com> wrote: