I have a dataframe ACC
which looks like following: The dataframe shows miRNA and Target interactions:
ACC:
miRNAs Targets
MIMAT0000075 HIF1A
MIMAT0000449 CXCR4
MIMAT0000421 CYP7A1
MIMAT0000279 STAT5A
MIMAT0000076 RASGRP1
I converted the above long format to wider format using mutate
and pivot_wider
. I used the following snippet for the conversion: If there is interaction it will be 1
else 0
library(dplyr)
library(tidyr)
validated_targets <- ACC %>%
mutate(n = 1) %>%
pivot_wider(names_from = miRNAs, values_from = n, values_fill = list(n = 0))
The output looks like below:
Help needed:
The above dataframe is just a small example. I have a dataframe with 400639 rows and two columns. The dimension of my original data is below:
dim(originaldata)
[1] 400639 2
I'm not able to convert my original data from long to wider format in Rstudio
. Can anyone please tell me how to convert such huge file from long to wider format like the output given above?
thanq