i have all necessary files as per toy examples, i made circle with my data but when comes to chord_data it shows error. the error i have got is
Error in [<-(*tmp*, g, p, value = ifelse(M[g] %in% sub2$genes, 1, : subscript out of bounds
as per my search(web), in the above lines it should be sub2$genes, 1,0, but zero is missing in this error. i am new to R and i could not understand the source they given bellow is, if(is.vector(genes)){ M <- genes[genes%in%unique(subData$genes)] mat <- matrix(0, ncol = length(process), nrow = length(M)) rownames(mat) <- M colnames(mat) <- process for (p in 1:length(process)){ sub2 <- subset(subData, BPprocess == process[p]) for (g in 1:length(M)) mat[g, p] <- ifelse(M[g]%in%sub2$genes, 1, 0) } }else{ genes <- subset(genes, genes %in% unique(subData$genes)) N <- length(process) + 1 M <- genes[,1] mat <- matrix(0, ncol = N, nrow = length(M)) rownames(mat) <- M colnames(mat) <- c(process, 'logFC') mat[,N] <- genes[,2] for (p in 1:(N-1)){ sub2 <- subset(subData, BPprocess == process[p]) for (g in 1:length(M)) mat[g, p] <- ifelse(M[g]%in%sub2$genes, 1, 0)
can anyone understand the codes, kindly help me to solve this, thanks in advance
1 answer
The function takes three arguments: data, genes and process. The error you mentioned can happen if there are no data lines with an appropriate process. This can happen, for instance, if the process parameter is null. Try to check the value of the parameters and maybe post your own code.
Log in to answer this question.