First of all: I am not sure if this is the correct approach for my scenario.
There is a questionairy with 4 possible checkmarks ("A", "B", "C", "D") coded in the original data from 0 to 3.. Imagine they are as age groups (under 30, 31 to 50, ...). No I want to have something like value lables (like SPSS offers) to use them later in summary tables or plots. In my understanding R offers the levels for this.
The problem now is that currently the "A" (coded as 0) currently not exist in the data. But this can change in the future because the data is not fixed yet.
How can I set a level (SPSS meaning: value label) for a value (0 in this example) that currently not exist in the data?
> set.seed(100)
> s <- sample(c(seq(1,3), NA), 10, replace=TRUE)
> f <- factor(s)
> f
[1] 2 2 3 1 2 2 <NA> 2 3 1
Levels: 1 2 3
> levels(f) <- c("A", # = 0
+ "B", # = 1
+ "C", # = 2
+ "D") # = 3
> f
[1] B B C A B B <NA> B C A
Levels: A B C D