In the R cli I am able to do the following on a character column in a data frame:
> data.frame$column.name [data.frame$column.name == \"true\"] <- 1 &g
Since you're dealing with values that are just supposed to be boolean anyway, just use == and convert the logical response to as.integer:
==
as.integer
df <- data.frame(col = c("true", "true", "false")) df # col # 1 true # 2 true # 3 false df$col <- as.integer(df$col == "true") df # col # 1 1 # 2 1 # 3 0