jeudi 17 mai 2018

'if' statement in R

Consider the following data:

x <- c(4,2,4,6,9,2)
y <- c(2,1,5,2,10,4)
k <- c(25,25,25,30,30,30,30)
d <- data.frame(x,y,k)

Now I want to do the following calculation:

e1 <- dea(d$x, d$y, XREF = d$x, YREF = d$y)

But I want to change it, so XREF and YREF only consider column x in d if k = 25. Something like:

e1 <- dea(d$x, d$y, XREF = d$x if k = 25, YREF = d$y if k = 25)

But this does not work. Can someone show me how to code this in R?

Aucun commentaire:

Enregistrer un commentaire