I need to create additional name for my\_function(i,x) (where `i` can be an integer from 1 to 25). I'd like it to work like this

* my\_function1(x) sames as my\_function(1,x)
* my\_function2(x) sames as my\_function(2,x)
* my\_function3(x) sames as my\_function(3,x)
* ...
* my\_function25(x) sames as my\_function(25,x)

One way to do achieve this would be:

```
my_function1 <- function (x) my_function(1, x)
my_function2 <- function (x) my_function(2, x)
my_function3 <- function (x) my_function(3, x)
...

```

But since there are 25 of them it would be reasonable to make it in a loop. For this I've tried:

```
for(i in 1:25){
  assign(paste("my_function",i,sep=""),function(x) my_function(i,x))
}

```

but it doesn't work since `i` is passed by reference and in the end the result was

* my\_function1(x) sames as my\_function(25,x)
* my\_function2(x) sames as my\_function(25,x)
* my\_function3(x) sames as my\_function(25,x)
* ...

How can I pass "i" by value? Or perhaps there is some other way...

Why would I want to do this? I'm improving someones else R package in terms of efficiency but at the same time I need it to be compatible with old version.