简体   繁体   English

如何在 R 中编写 function

[英]How to write a function in R

given a function给定一个 function

在此处输入图像描述

I'm not sure how to write this in R, I wrote it as:我不确定如何在 R 中写这个,我把它写成:

在此处输入图像描述

But I'm getting this error:但我收到了这个错误:

钛

Maybe you are looking for this:也许你正在寻找这个:

#Function
f <-function(x) {4*x*exp(-2*x)}
#Integral
integrate(f,lower = 0,upper = Inf)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM