Work around different treatment of character types across remote data sources when adding a constant column to a table. Deals with issues such as Postgresql requiring a character-cast and MySQL not allowing such.

addConstantColumn(
  d,
  colName,
  val,
  ...,
  tempNameGenerator = mk_tmp_name_source("replyr_addConstantColumn")
)

Arguments

d

data.frame like object to add column to.

colName

character, name of column to add.

val

scalar, value to add.

...

force later arguments to be bound by name.

tempNameGenerator

temp name generator produced by wrapr::mk_tmp_name_source, used to record dplyr::compute() effects.

Value

table with new column added.

Examples

d <- data.frame(x= c(1:3)) addConstantColumn(d, 'newCol', 'newVal')
#> x newCol #> 1 1 newVal #> 2 2 newVal #> 3 3 newVal