Entering edit mode
3.9 years ago
andresllucena
▴
40
I have a data frame as follows:
miRNA_region barcode read_count
MIMAT0000062 TCGA-05-4244-01A-01T-1108-13 14492
MIMAT0000063 TCGA-05-4244-01A-01T-1108-13 8767
MIMAT0000064 TCGA-05-4244-01A-01T-1108-13 610
MIMAT0000065 TCGA-05-4244-01A-01T-1108-13 750
MIMAT0000066 TCGA-05-4244-01A-01T-1108-13 804
MIMAT0000067 TCGA-05-4244-01A-01T-1108-13 4748
MIMAT0000062 TCGA-05-4384-01A-01T-1754-13 505712
MIMAT0000063 TCGA-05-4384-01A-01T-1754-13 121127
MIMAT0000064 TCGA-05-4384-01A-01T-1754-13 12833
MIMAT0000065 TCGA-05-4384-01A-01T-1754-13 1455
MIMAT0000067 TCGA-05-4384-01A-01T-1754-13 15284
Barcode corresponds to different samples. I need to convert the values in ''barcode'' column into new columns and get something like:
miRNA_region TCGA-05-4244-01A-01T-1108-13 TCGA-05-4384-01A-01T-1754-13
MIMAT0000062 14492 505712
MIMAT0000063 8767 121127
MIMAT0000064 610 12833
MIMAT0000065 750 1455
MIMAT0000066 804 15284
I'm sorry, I will correct that. I used values from samples after the first one trying to improve the example. Thank you so much.
P.S.: function
pivot_wider
seem to be from tidyr package and not dplyr.Nice catch, I edited my post with the correction.