I am having trouble showing a vector of the unique values when I put call a unique
on a vector in an ifelse
statement as seen below.
> row <- c(1, 1, 1, 3, 3, 3)
> unique(row)
[1] 1 3
> ifelse(is.null(NULL), unique(row), 2)
[1] 1
I would like for the ifelse statement to return the same as unique(row)
if indicated that it is NULL
.
Thank you in advance!
This can be solved with an if/else
statement:
> if(is.null(NULL)) {unique(row)} else {2}
[1] 1 3