Setting col_names = TRUE always includes the column names, even if append = TRUE.
However it defaults to !append, so if you append only if a file already exists I think it will have the behavior you are looking for. e.g.
library("readr")
mt <- head(mtcars)
out_file <- "mtcars.csv"
for (i in 1:3) {
write_csv(mt, out_file, append = file.exists(out_file))
}
readLines("mtcars.csv")
#> [1] "mpg,cyl,disp,hp,drat,wt,qsec,vs,am,gear,carb"
#> [2] "21,6,160,110,3.9,2.62,16.46,0,1,4,4"
#> [3] "21,6,160,110,3.9,2.875,17.02,0,1,4,4"
#> [4] "22.8,4,108,93,3.85,2.32,18.61,1,1,4,1"
#> [5] "21.4,6,258,110,3.08,3.215,19.44,1,0,3,1"
#> [6] "18.7,8,360,175,3.15,3.44,17.02,0,0,3,2"
#> [7] "18.1,6,225,105,2.76,3.46,20.22,1,0,3,1"
#> [8] "21,6,160,110,3.9,2.62,16.46,0,1,4,4"
#> [9] "21,6,160,110,3.9,2.875,17.02,0,1,4,4"
#> [10] "22.8,4,108,93,3.85,2.32,18.61,1,1,4,1"
#> [11] "21.4,6,258,110,3.08,3.215,19.44,1,0,3,1"
#> [12] "18.7,8,360,175,3.15,3.44,17.02,0,0,3,2"
#> [13] "18.1,6,225,105,2.76,3.46,20.22,1,0,3,1"
#> [14] "21,6,160,110,3.9,2.62,16.46,0,1,4,4"
#> [15] "21,6,160,110,3.9,2.875,17.02,0,1,4,4"
#> [16] "22.8,4,108,93,3.85,2.32,18.61,1,1,4,1"
#> [17] "21.4,6,258,110,3.08,3.215,19.44,1,0,3,1"
#> [18] "18.7,8,360,175,3.15,3.44,17.02,0,0,3,2"
#> [19] "18.1,6,225,105,2.76,3.46,20.22,1,0,3,1"
Created on 2021-07-08 by the reprex package (v2.0.0)