Re: [R] Execution of a function

2012-08-07 Thread hafida
HI Arun and all >my function is: >aj.fun <- function(j, i, X, z, E, beta0, beta1){ + n <- length(X) + iX <- order(X) + iz <- order(z) + e1 <- -(beta)*z[ iz[1:(i - 1)] ] + numer <- E[j] - sum( X[ iX[1:(i - 1)] ] * exp(e1) ) + e2 <- -(beta)*z[ iz[i:n] ] + denom <- sum( exp(e2) ) + numer/denom + } >

Re: [R] Execution of a function

2012-08-07 Thread R. Michael Weylandt
Please do keep your replies on the R help list. On Tue, Aug 7, 2012 at 4:17 PM, hafida goual wrote: > > HI >> >>I know my questions are debile, but please I'm debutante. > >>> source("functionaj") > Error in file(filename, "r", encoding = encoding) : > cannot open the connection > In addition:

Re: [R] Execution of a function

2012-08-07 Thread arun
ion(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))]) )  } a1<-c(-5,-2,4,2,-4,-6,3) > fun1(a1) #[1] -7 Hope this helps. A.K. - Original Message - From: hafida To: r-help@r-project.org Cc: Sent: Tuesday, August 7

Re: [R] Execution of a function

2012-08-07 Thread R. Michael Weylandt
On Tue, Aug 7, 2012 at 11:26 AM, hafida wrote: > 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 inst

[R] Execution of a function

2012-08-07 Thread hafida
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 th