HI,
Suppose, I have a function like this:
fun1<-function(x){
?ifelse(x[1]<0,
?sum(x[min(which(x<0)):(which.max(x>0)-1)]),
sum(x[min(which(x<0)):max(which(x<0))])
)
?}
#And I save it as "aj.fun" (-- filename)
#Then,
#[1] -7
Hope this helps.
A.K.
----- Original Message -----
From: hafida <hafida-06 at hotmail.fr>
To: r-help at r-project.org
Cc:
Sent: Tuesday, August 7, 2012 12:26 PM
Subject: [R] Execution of a function
Hi
i have? aproblem withe execution of my function
first, i wrote my function in the script of R
nom_fonction <- function(arg1[=expr1], arg2[=expr2], ...){
bloc d'instructions
}
when i want to have the result i mean the laste instruction in the bloc of
instruction ,? i try to
wrote the name of function
source(aj.fun)
Error in readLines(file, warn = FALSE) : 'con' is not a connection