Hi I apply the survival analysis in Survival analysis of TCGA patients integrating gene expression (RNASeq) data
and there the code in below
for (i in 1:dim(new_tum)[1]){
ifsumis.na(new_tum[i,])) < dim(new_tum)[2]){
m <- min(new_tum[i,],na.rm=T)
new_tum_collapsed <- c(new_tum_collapsed,m)
} else {
new_tum_collapsed <- c(new_tum_collapsed,'NA')
}
}
but R gave me the following error
> for (i in 1:dim(new_tum)[1]){
+ ifsumis.na(new_tum[i,])) < dim(new_tum)[2]){
Error: unexpected ')' in:
"for (i in 1:dim(new_tum)[1]){
ifsumis.na(new_tum[i,]))"
> m <- min(new_tum[i,],na.rm=T)
Error: object 'i' not found
> new_tum_collapsed <- c(new_tum_collapsed,m)
Error: object 'm' not found
> } else {
Error: unexpected '}' in " }"
> new_tum_collapsed <- c(new_tum_collapsed,'NA')
> }
Error: unexpected '}' in " }"
> }
Error: unexpected '}' in "}"
can you help why?
R tells you where the error is... Did you read the message?
You have one extra closing
)
in second line before<
. Remove that and run again.You are right. There is a bug in the tutorial code.