I have the following table with more than 30,000 lines
1 1 ne A 1 en B 1 hi C 2 2 ne D 2 ew E 2 en F 2 hi G 3 3 en H 3 ne I 3 ew J
The result I'm trying to get is:
en ew hi ne 1 B C A 2 F E G D 3 H J I
Can any body help me?
I have the following table with more than 30,000 lines
1 1 ne A 1 en B 1 hi C 2 2 ne D 2 ew E 2 en F 2 hi G 3 3 en H 3 ne I 3 ew J
The result I'm trying to get is:
en ew hi ne 1 B C A 2 F E G D 3 H J I
Can any body help me?
Assuming that your table is called df
and the columns of your table are named X1
, X2
, X3
try the following:
library(dplyr)
library(tidyr)
df %>%
spread(X2, X3)