Hi,

**I've a problem with this function:**

k <- function(x){

if(x > 0) {2*exp(-2*x)}

if(x < 0) {0*x}

}

**I can't integrate it like I want:**

integrate(k, -Inf, +Inf)

**It gives this error:**

Error in integrate(k, -Inf, +Inf) :

evaluation of function gave a result of wrong length

In addition: Warning messages:

1: In if (x > 0) { :

the condition has length > 1 and only the first element will be used

2: In if (x < 0) { :

the condition has length > 1 and only the first element will be used

**Can somebody help me to write it right?**