I have a data frame, df
, which I have stacked and merged with another data frame, info_df
.
I call it Ta_stacked
On the basis of info_df
I sort my stacked data frame, by the column Progression.
After that I remove the columns from the info_df
sorted_stacked = arrange(Ta_stacked, Progression) %>%
select(gene_ekspression, sample) %>% drop_levels()
When I unstack my new sorted df, the sorting I did is overruled by unstacks alphabetically sorting.
sorted_df = unstack(sorted_stacked))
I have tried to use the as.data.frame
:
sorted_df = as.data.frame(unstack(sorted_stacked))
Any ideas on what to do?
Here is pictures of my workflow, the matrices is just examples because I am working with a really big dataset.