Dear Barry,
some thoughts:
1) e in your function status_fnc is a vector when applied on a matrix
like object, but you index it as a matrix (e[,i] should be e[i]).
2) You can simplify the if statement by using the function any
(replacing all the OR statements) on the vector, so use any(e=='Y')
her
ex1 <- c('Y', 'N', 'Y')
ex2 <- c('Y', 'N', 'Y')
ex3 <- c('N', 'N', 'Y')
ex4 <- c('N', 'N', 'Y')
status <- array(NA, dim=3)
# I am trying to return 'Okay' if any of the values
# in a column above is 'Y' but I am not constructing
# the function corrrectly. Any assistance is
# greatly appreciated
2 matches
Mail list logo