I'm trying to create and use a function that calculates the factorial of a given number and use this in an another function that calculates the Euler's Number. However i don't understand why the code is giving the + signs on the output. End project needs to be without the + signs.
I know that i could simply use factorial() and exp() but i need to calculate them this way for a project.
calc_fact <- function(m){
factorial = 1
if(m>0){
for(i in 1:m) {
factorial = factorial * i
}
}
return(factorial)
}
emake <- function(n){
e <- 0
for (i in 0:n){
e <- e+ 1/(calc_fact(i))
}
return(e)
}
emake(10)