Hello,
When I use "apply" on a data frame, it seems like I get an error when I have a column that is not numeric. Via trial and error I realized that if I remove that column, I can get it to run. Is there a better way to tell the function not to worry about the character columns, especially since I am not even trying to do any calculations on it?
R_Cat is the character column that is causing error and I am trying to do calculations on t5R.

Data_F_Cat$t5R_Cat = apply(Data_F[,names(Data_F) != "R_Cat"],1,function(row) {
    ifelse( abs(row["t5R"]) <Thresh1, 0,
    ifelse( abs(row["t5R"]) <Thresh2, ifelse( row["t5R"] <0, -1, 1),
    ifelse( abs(row["t5R"]) <Thresh3, ifelse( row["t5R"] <0, -2, 2),
    ifelse( abs(row["t5R"]) <Thresh4, ifelse( row["t5R"] <0, -3, 3),
    ifelse( abs(row["t5R"]) <0, -4, 4)))))
})


Thank you,
Pooya.


THIS E-MAIL IS FOR THE SOLE USE OF THE INTENDED
RECIPIENT(S) AND MAY CONTAIN CONFIDENTIAL AND
PRIVILEGED INFORMATION.

ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE OR
DISTRIBUTION IS PROHIBITED. IF YOU ARE NOT THE
INTENDED RECIPIENT, PLEASE CONTACT THE SENDER
BY REPLY E-MAIL AND DESTROY ALL COPIES
OF THE ORIGINAL E-MAIL.




	[[alternative HTML version deleted]]

