Following is a function that I wrote (It is working well). It's a simple one, nothing complicated. The only question that I have is a qutation mark issue, I guess. ############################################# funcname <- function(trait.file){ #line1 setwd('/root/subroot') # line 2 load('imge.RData') # line3 imge <- imge[,-c(3)] # line4 imge <- imge[complete.cases(imge),] # line5 trait<- read.csv(trait.file) # line6 ngenes <- nrow(imge) # line7 nsnp <- nrow(trait) #line 8 for(i in 1:ngenes) { for(j in 1:nsnp) { if(imge$d1[i]==trait$d1[j] & imge$d2[i]==trait$d2[j]) trait$imgene2[j] <- imge$Gene[i] else trait$imgene2[j] <- NA } } return(trait) }
hypertension <- funcname("folder/hyper.csv") # last line ###################################### So, as we all know, when using "read.csv", we need to use qutation mark out side the filename which we wanna read in. At first, for line 8, I wrote: read.csv("trait.file"), at last line, I wrote: funcname(folder/hyper.csv), but it did not work in this way. Unless I changed the code to the current one that I showed above, I couldn't get what I want. So, to be straightforward, I will show the difference: 1) the code not working: read.csv("trait.file") #line 8 funcname(folder/hyper.csv) #last line 2) the code working: read.csv(trait.file) # line 8 funcname("folder/hyper.csv") # last line anyone can tell me why is the difference? thank you, karena -- View this message in context: http://r.789695.n4.nabble.com/a-issue-about-the-qutation-mark-tp2291537p2291537.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.