No, there's no way to reverse that change. If you did
original <- c(1.1,2.1,2.1,1.1,2.1)
manipulated <- factor(original)
then the values 1.1 and 2.1 would be converted to character strings and stored as the levels. But your conversion
manipulated <- factor(original, labels = c("one", "two") )
overwrites the levels with c("one", "two")
, so the original values are no longer part of manipulated
.
If you wanted the change to be reversible, you could do the manipulation in two steps:
original <- c(1.1,2.1,2.1,1.1,2.1)
manipulated <- factor(original)
savedLevels <- levels(manipulated)
levels(manipulated) <- c("one", "two")
restored <- as.numeric( savedLevels[manipulated] )
restored
#> [1] 1.1 2.1 2.1 1.1 2.1
It's not guaranteed to be perfect since character versions of numbers aren't exact, but it's going to be very close.