My data look like this:
round <- c(rep(\"A\", 3), rep(\"B\", 3))
experiment <- rep(c(\"V1\", \"V2\", \"V3\"), 2)
results <- rnorm(mean = 10, n = 6)
You could also try this:
library(tidyr)
library(dplyr)
df = df %>%
unite(combined, round, experiment, sep = "_", remove = FALSE)
The output will be:
combined round experiment results
A_V1 A V1 10.152329
A_V2 A V2 10.863128
A_V3 A V3 10.975773
B_V1 B V1 9.964696
B_V2 B V2 9.876675
B_V3 B V3 9.252936
This will retain your original columns.