I guess you're after something like this:
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(tidyr)
IPC_data <- data.frame(stringsAsFactors = FALSE,
Country = c("US", "WO", "GB", "IT", "NL", "US", "US"),
Year = c(1980, 1980, 1992, 1997, 2001, 2003, 2003),
IPC1 = c("F01C 01/23", "F01C 01/23", "F04F 02/33", "F04F 02/55",
"H04E 27/55", "E05/F 23/23", "F07E 14/03"),
IPC2 = c("F03D 02/33", "G06R 04/44", "F04F 02/55", "E05/F 23/23",
"F01C 01/23", "H04E 27/55", "F04F 02/33"),
IPC3 = c("H04E 27/55", "R04C 44/01", "F07E 14/03", "F03D 02/33",
"D04D 01/01", "F04F 02/33", "F01C 01/23"))
IPC_data %>%
gather(key = IPC,
value = Value,
starts_with("IPC")) %>%
group_by(Year) %>%
distinct(Value) %>%
mutate(temp = substr(x = Value,
start = 1,
stop = 1)) %>%
count(temp) %>%
ungroup()
#> # A tibble: 13 x 3
#> Year temp n
#> <dbl> <chr> <int>
#> 1 1980 F 2
#> 2 1980 G 1
#> 3 1980 H 1
#> 4 1980 R 1
#> 5 1992 F 3
#> 6 1997 E 1
#> 7 1997 F 2
#> 8 2001 D 1
#> 9 2001 F 1
#> 10 2001 H 1
#> 11 2003 E 1
#> 12 2003 F 3
#> 13 2003 H 1
Created on 2019-05-20 by the reprex package (v0.3.0)
But it won't be displayed as you've shown in the table in your post.
After you apply distinct(Value), there's no Year column, only the Value column is retained. To keep all columns, use the argument .keep_all.