R Studio add_row with dynamic field name
As in other dpylr verbs you could assign values to dynamically created LHS names by using the walrus operator := and !!sym(col) or glue syntax "{col}".
Using a minimal reproducible example based on mtcars:
library(dplyr, warn=FALSE)

col <- "cyl"
mtcars |> 
  head() |> 
  add_row(cyl = 1) |> 
  add_row("{col}" := 2) |> 
  add_row(!!sym(col) := 3)
#>                    mpg cyl disp  hp drat    wt  qsec vs am gear carb
#> Mazda RX4         21.0   6  160 110 3.90 2.620 16.46  0  1    4    4
#> Mazda RX4 Wag     21.0   6  160 110 3.90 2.875 17.02  0  1    4    4
#> Datsun 710        22.8   4  108  93 3.85 2.320 18.61  1  1    4    1
#> Hornet 4 Drive    21.4   6  258 110 3.08 3.215 19.44  1  0    3    1
#> Hornet Sportabout 18.7   8  360 175 3.15 3.440 17.02  0  0    3    2
#> Valiant           18.1   6  225 105 2.76 3.460 20.22  1  0    3    1
#> ...7                NA   1   NA  NA   NA    NA    NA NA NA   NA   NA
#> ...8                NA   2   NA  NA   NA    NA    NA NA NA   NA   NA
#> ...9                NA   3   NA  NA   NA    NA    NA NA NA   NA   NA


I have a function here, where my intent is to add a record to the table.  The column name is dynamically defined based on the firstCharVar variable.
The dataframe tblname is a blank table.  The first character field in that table is called myvar.  There are other columns in that table, and they should remain blank.
#update tables if no records
NoData = function(tblname) {
  if (nrow(tblname) == 0) {

  #get column name of first character field
  allColumns = data.frame(
    colName = colnames(tblname),
    colIndex = 1:ncol(tblname),
    colClass = sapply(tblname, class)
  )
  charVars     = allColumns[allColumns$colClass == 'character', ]
  firstCharVar = unfactor(charVars$colName[1])

  #run insert statement
  #this doesn't work
  #Error: unexpected '=' in "tblname = tblname %>% add_row(!!firstCharVar ="
  #tblname = add_row(tblname, !!firstCharVar = 'No Data Found')

  #but this does
  tblname = add_row(tblname, myvar = 'No Data Found')

  
  #clean up stuff used in function
  #rm(allColumns, charVars, firstCharVar)
}}

temp2 = NoData(temp2)

