I've a .txt file which has 56 columns. The dataset with multiple columns where each column represents a different sample, and I want to reshape this dataset from wide to long format using the gather() function from the tidyr package in R. However, after applying gather(), all samples are assigned the same name in the "samples" column.
My code:
data %>%
gather(key="samples",value="counts",-Gene) %>%
head()
Why am i getting same name for every sample? How to fix it? Thank you so much
I expected each sample to have its own distinct name in the "samples" column after reshaping the data. Specifically, I thought that each column name representing a sample in the original dataset would be represented as a unique value in the "samples" column.
However, after applying gather(), all samples were assigned the same name "CKC1" in the "samples" column. This was unexpected and not the desired outcome. I expected to see distinct sample names corresponding to the original column names, but this did not happen.