What is the difference between gather, reshape, cast, and similar functions? I know they are all helpful in transitioning between long and wide data, but I am having trouble using them. The documentation tends to use terms like "id" variables and "time" variables, but I am not sure what is what.
I have a dataframe like this:
data <- data.frame(id = c(rep("A", 10), rep("B", 10), rep("C", 10)),
val = 1:30)
I am trying to reformat it to look like this:
res <- data.frame(A = 1:10,
B = 11:20,
C = 21:30)
How could I most easily accomplish this? Any tips. I know this is an "easy" question but I am stumped. Thanks in advance.