results<-list()
for(i in unique(g,g$`cancer type abbreviation`)){
z<-subset(g,g$`cancer type abbreviation`= i)
z<-z$sample
new.m<-m[m$sample % in % z,]
important.value <-mean(new.m$RNAss)
results[(i)] <-important.value
}
When I run this loop, I'm getting following error continuously. Plz help me to solve it.
> results<-list()
> for(i in unique(g,g$`cancer type abbreviation`)){
+ z<- subset(g,g$`cancer type abbreviation`= i)
Error: unexpected '=' in:
"for(i in unique(g,g$`cancer type abbreviation`)){
z<- subset(g,g$`cancer type abbreviation`="
I'm not sure whether unique is what you want. Unless some of the rows in g are identical, unique is going to give you back g. Wouldn't that be 12,000 rows rather than 33?
Perhaps you dput() to post a piece of your data and tell us what you are looking for out of that piece.