How to spread my dataset under different categories

Ideally, you should provide a reproducible example for your issue, you can learn how to make one by reading this FAQ

Since you are new to R, I'm going to give you an example with some made-up data, this is an extra effort for people trying to help you so next time, please read the guide and try to provide a proper reprex.

library(tidyverse)

sample_df <- data.frame(
    stringsAsFactors = FALSE,
    item_code = c(100, NA, NA, NA, 200, NA, NA, NA),
    item = c("A", "a1", "a2", "a3", "B", "b1", "b2", "b3")
)

sample_df
#>   item_code item
#> 1       100    A
#> 2        NA   a1
#> 3        NA   a2
#> 4        NA   a3
#> 5       200    B
#> 6        NA   b1
#> 7        NA   b2
#> 8        NA   b3

sample_df %>% 
    mutate(item_code = ifelse(!is.na(item_code), item, item_code)) %>% 
    fill(item_code, .direction = "down") %>% 
    filter(item_code != item)
#>   item_code item
#> 1         A   a1
#> 2         A   a2
#> 3         A   a3
#> 4         B   b1
#> 5         B   b2
#> 6         B   b3

Created on 2020-03-14 by the reprex package (v0.3.0.9001)