I have 3 tables that looks something like this (but with 40,000+ observations and 40 variables)
in1 out1 in2 out2 in3 out3
1 2 2 4 3 5
1 3 2 5 3 6
1 3 2 6 3 7
I want to take columns out1, out2, and out3 and make them one column, then create a new table that looks like this:
in out
1 2
1 3
1 3
2 4
2 5
2 6
3 5
3 6
3 7
So basically I want to take 3 huge tables I have, combine them into 1 table and then merge (stack? I don't know the correct wording) 3 specific columns together into 1 column with a new name.
I've tried a few methods such as:
table$out <- cbind(table1$out1, table2$out2, table3$out3)
but I get errors like this:
Error in `$<-.data.frame`(`tmp`, out, value = c(0.98, 0.59, 0.69, : replacement has 31467 rows, data has 42141 number of rows of result is not a multiple of vector length (arg 1)
I'm sorry if this is a very simple question.. I might just be overthinking it