apply different functions to different elements of a vector in R

前端 未结 1 1292
情书的邮戳
情书的邮戳 2021-01-06 06:38

apply is easy, but this is a nutshell for me to crack:

In multi-parametric regression, optimisers are used to find a best fit of a parametric function to say x1,x2 D

相关标签:
1条回答
  • 2021-01-06 07:42

    You must use this instead:

    x.trans <- c(log10,exp,log10,function(x)x^2,function(x)1/x)
    

    Then this:

    mapply(function(f, x) f(x), x.trans, x.val)
    
    0 讨论(0)
提交回复
热议问题