I would do something like this, in the example considering the data frame. mtcars which is already available on R.
The walk is a kind of loop that returns no results. With this code I am asking that for each element of the vector distintos, o R Construct the data.frame by variable cyl and then write this new data.frame in a file called var=valor_utilizado.csv" in the directory meudir.
library(purrr)
distintos <- unique(mtcars$cyl)
walk(distintos, ~mtcars[mtcars$cyl == .x,] %>%
write.csv(paste0("meudir/var=", .x, ".csv"))
)
This will create 3 files, one for each distinct variable value cyl:

Please provide a minimum and verifiable example. Perform a [tour] on the site, after this see [Ask], will help everyone who want to help you.
– Don't Panic