# BIS-Fogo

### Site Tools

en:learning:schools:s01:code-examples:ba-ce-03-01

### C03-1 Missing values

Handling missing values is straight forward. Let’s start with a vector with one NA value at position 3. Please note that NA is not inside quotation marks since it is not a string but a special type of logical data type.

x <- c("A", "B", NA, "D")

To check, if the vector has one or more “not available” values, use the is.na function.

is.na(x)
## [1] FALSE FALSE  TRUE FALSE

It returns another vector which gives a TRUE/FALSE answer of the question for each value in the data structure.

If, for any reason, we want to assign the term “no value” to NAs, the scripting is quite simple and follows the standard logic.

x[is.na(x)] <- "no value"

en/learning/schools/s01/code-examples/ba-ce-03-01.txt · Last modified: 2015/09/22 16:36 by tnauss