Here is one method. I invented that an initial digit of 3 or 4 designates the sector Clothes.
library(dplyr)
DF <- data.frame(Code = c(10105, 1112, 25441, 2422, 4552))
DF <- DF %>% mutate(Category = case_when(
substr(Code, 1, 1) %in% c(1,2) ~ "Food",
substr(Code, 1, 1) %in% c(3,4) ~ "Clothes",
TRUE ~ "Unknown"
))
DF
#> Code Category
#> 1 10105 Food
#> 2 1112 Food
#> 3 25441 Food
#> 4 2422 Food
#> 5 4552 Clothes
Created on 2022-04-21 by the reprex package (v0.2.1)