Entering edit mode
7.0 years ago
Spacebio
▴
200
Hello,
I have a file containing 11300 genes, looking like this:
A active B
B inactive C
C unknown E
D active D
E inactive A
A active C
B unknown A
C inactive D
D active E
E active B
After I stack the genes, I get a matrix like this:
A active
B inactive
C unknown
D active
E inactive
A active
B unknown
C inactive
D active
E active
B active
C inactive
E unknown
D active
A inactive
C active
A unknown
D inactive
E active
B active
Then, I remove the duplicates
and I get the following output:
A active
B inactive
C unknown
D active
E inactive
B unknown
C inactive
E active
B active
E unknown
A inactive
C active
A unknown
D inactive
After that, I would like to have a matrix like this:
Active Inactive Unknown
A 1 1 1
B 1 1 1
C 1 1 1
D 1 1 0
E 1 1 1
I tried with the followong syntax:
m <- matrix(nrow = 1467, ncol = 4)
for(column in 1){
m[, column] <- nodes$values
}
But with that I just construct the matrix without filling it. The 1467 is the total number of unique
genes in my file.
Can someone help me?
Thank you so much! I hate when the answer is so obvious that makes me feel dumb.