It seems like some of the examples below should generate warnings or errors.
df <- data.frame(
x = 1:3,
y = 4:6,
choice = c("x", "y", "x"),
stringsAsFactors = FALSE)
tidyr::gather(df, "k", "v")
## k v
## 1 x 1
## 2 x 2
## 3 x 3
## 4 y 4
## 5 y 5
## 6 y 6
## 7 choice x
## 8 choice y
## 9 choice x
tidyr::gather(df, "k", "x")
## k x
## 1 y 4
## 2 y 5
## 3 y 6
## 4 choice x
## 5 choice y
## 6 choice x
tidyr::gather(df, "x", "v")
## x v
## 1 y 4
## 2 y 5
## 3 y 6
## 4 choice x
## 5 choice y
## 6 choice x
tidyr::gather(df, "x", "y")
## x y
## 1 choice x
## 2 choice y
## 3 choice x
tidyr::gather(df, "x", "x")
## x x
## 1 y 4
## 2 y 5
## 3 y 6
## 4 choice x
## 5 choice y
## 6 choice x