Hello All,
I have a data frame like as follows,
> df
A B C D E
1 1 2 3 4 5
2 4 5 6 7 7
3 7 8 9 8 9
where rows are Genes and Column are Sample Ids, I want to index the normal/disease samples. Normal samples are A, B and disease samples are D & E (For example). I have a Phenotypic file as follows
> Pheno
sample status
1 A Normal
2 B Normal
3 C Unknown
4 D Diseased
5 E Diseased
Now my question is How to index samples in 'df', say == 0 for normal and == 1 for Diseased in R based on Pheno file classification. (Indexing samples into Normal and Diseased from RNAseq raw counts file.) Hope I am clear, it would be great if you can help me in this.Thanks a lot for your help
Regards,
Have a great day,
Dave.
see if this works:
Following also work for listing normal and diseased:
Essentially exactly the same method as mine. Why use
t()
? Use double square brackets to get vector[[1]]