When I try to grep the last line of this list, R returns all the lines in the list, is there a way to make R only grep the last line in this example?
stringlines<-as.list(c("Total des actifs immobilisés 350 952","Total des actifs non courants 357 268",
"Total des actifs courants 4 324 646",
"Total des actifs 4 682 115"))
stringlines[grep("Total des actifs",stringlines,fixed = T)]
#> [[1]]
#> [1] "Total des actifs immobilisés 350 952"
#>
#> [[2]]
#> [1] "Total des actifs non courants 357 268"
#>
#> [[3]]
#> [1] "Total des actifs courants 4 324 646"
#>
#> [[4]]
#> [1] "Total des actifs 4 682 115"
Created on 2021-05-18 by the reprex package (v1.0.0.9002)