Hello everybody, I am new to R and I discovered something that suprise me and I have a question about it. Today I wanted to return a bit array which represents this:
if( arbitrary point above the line) return TRUE else return FALSE First I tought I would use for loop and access every element of the data. Then I tend to use lapply function. At the end, I accidently done that without using any if/else statement. ( or for loop ) Here is the code: data <- data.frame(x= c(1,2,3,1,1,1), y = c(1,2,3,4,6,7))fin_hyp <- list(slope=2,constant=1)outputs <- data['y'] > fin_hyp['slope'] * data['x'] +fin_hyp['constant']outputs What is R doing here? It is using loop somewhere inside? Is this code more efficient than other methods I mentioned? Thank you, I.S. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.