Calculate how many times R has remplace data

Thanks for including the code. I've reproduced it in reprex form using the reprex addin to RStudio, which is always helpful to peeps looking at the question.

If I have understood the question correctly, a solution is at the end

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
trayectory<-data.frame(stringsAsFactors=FALSE,
ID_Name = c("%%EDH_WSN", "%DIPA_PITES", "%DIPI_LADAT", "%DRSI_SITET",
"%200_BAKER", "%%WSN_EDH", "%PITES_DIPA", "%BAKER_200"),
ID_Name_New = c("%%EDH_WSN", "%DIPA_PITES", "%DIPI_LADAT", "%DRSI_SITET",
"%200_BAKER", "%%EDH_WSN", "%DIPA_PITES", "%200_BAKER")
)
solution<-data.frame(stringsAsFactors=FALSE,
ID_Name = c("%%EDH_WSN", "%DIPA_PITES", "%DIPI_LADAT",
"%DRSI_SITET", "%200_BAKER", "%%WSN_EDH",
"%PITES_DIPA", "%BAKER_200"),
ID_Name_New = c("%%EDH_WSN", "%DIPA_PITES", "%DIPI_LADAT",
"%DRSI_SITET", "%200_BAKER", "%%EDH_WSN",
"%DIPA_PITES", "%200_BAKER"),
Trafico_Enfrentado = c("YES", "YES", "NO", "NO", "YES", "YES", "YES", "YES"),
Which_Segment = c("%%WSN_EDH", "%PITES_DIPA", "NA", "NA",
"%BAKER_200", "%%EDH_WSN", "%DIPA_PITES",
"%200_BAKER")
)
solution %>% group_by(Trafico_Enfrentado) %>% count()
#> # A tibble: 2 x 2
#> # Groups:   Trafico_Enfrentado [2]
#>   Trafico_Enfrentado     n
#>   <chr>              <int>
#> 1 NO                     2
#> 2 YES                    6

Created on 2019-12-15 by the reprex package (v0.3.0)