Here are examples of two methods. The first on is the one suggested by @arthur.t . It has the advantage of clearly showing the intended replacements and preserving the original column. In the second method, I take advantage of the fact that the replacement amounts to extracting the numeric characters from the original values. I realize that might not be actually true in your real data.
library(dplyr)
library(tibble)
DF <- tibble(Treatment = c("Treatment 1", "Treatment 2", "Treatment 1", "Treatment 3"),
Value = c(32,14,35,24))
DF
#> # A tibble: 4 × 2
#> Treatment Value
#> <chr> <dbl>
#> 1 Treatment 1 32
#> 2 Treatment 2 14
#> 3 Treatment 1 35
#> 4 Treatment 3 24
translate <- tibble(old = c("Treatment 1", "Treatment 2", "Treatment 3"), new = c("1", "2", "3"))
#arthur.t method
DF <- left_join(DF, translate, by = c(Treatment = "old"))
DF
#> # A tibble: 4 × 3
#> Treatment Value new
#> <chr> <dbl> <chr>
#> 1 Treatment 1 32 1
#> 2 Treatment 2 14 2
#> 3 Treatment 1 35 1
#> 4 Treatment 3 24 3
#method with stringr
library(stringr)
DF <- tibble(Treatment = c("Treatment 1", "Treatment 2", "Treatment 1", "Treatment 3"),
Value = c(32,14,35,24))
DF <- DF %>% mutate(Treatment = str_extract(Treatment, "\\d+"))
DF
#> # A tibble: 4 × 2
#> Treatment Value
#> <chr> <dbl>
#> 1 1 32
#> 2 2 14
#> 3 1 35
#> 4 3 24
Created on 2022-04-14 by the reprex package (v0.2.1)