Hello i have a data frame which i want to mean some rows. I am using
imc <- dfWoNA[1,]
imc <-head(imc,-1)
id20 <- unique_entrezgene_ids[1:20]
for (j in id20) {
rows <- dfWoNA [which(dfWoNA$X == as.double(j)),]
temp <- colMeans(rows[,2:285], na.rm = FALSE)
nx <- c(j,temp)
imc <- rbind(imc,nx)
rm(rows)
rm(nx)
rm(temp)
}
shown states however the result of function above i am only taking result for the first line if do the same without for loop manually i am taking result for each of the elements in id20 but for loop gives NA results for the lines except first. If you can help me i appreciate that. Thank you.