I was not able to find the solution to this easy question in R. How to apply a "user defined" function to each element (cell) of a dataframe with out looping?
func <- function(cell){
if (cell==1) return("hello")
else return ("bye")
}
Please do not try to say you can replace 1 with "hello" in your dataframe. It is just an example of user-defined function on a scalar but we can apply it to each element. The function might be a few hundred lines of code. I tried to mapply and sapply but did not work. Apparently, I am missing something. Thank you in advance.