In this line:
if (is.na(x) == FALSE) {
x is a vector, so you presumably want any(is.na(x)) or possibly
all(is.na(x)) depending on what you are intending to check for.
When I run your function (thanks for the reproducible example), the
error I get is:
Warning message:
In if (is.na(x) == FALSE) {
I can't figure out why this function wont work.
#Custom Function used
fallInBand <- function(x){
#Assume the bands fall go up form 0 to 100 in intervals of 5 then from 100
to 1000 in intervals of 100.
#returns the location (band number)
if (is.na(x) == FALSE) {
if(x < 100) {#bands of 5
2 matches
Mail list logo