[R-sig-Epi] import data repeadeatly

Randy Johnson randy.n.julie at gmail.com
Fri Mar 28 13:02:32 CET 2008


See ?read.table for some helpful options. Also, you probably don't  
want to use <<- so much. <- should (almost) always be sufficient and  
is less likely to be the cause of strange bugs.

On Mar 28, 2008, at 3:08 AM, Henrik Kallberg wrote:
> Repeadeately
> Dear All!
> I'm an unexperienced user of R. I'm trying to import varaibles in a  
> stepwise manner from a huge data set (whole genome scan data from a  
> case control study). I'm not sure that my code will work and I know  
> that the current code is not working the way I want it to work. I  
> would like to import data and do some calculations and then store  
> the results and then import a new variable and do the same  
> calculations again for the latter variable and so on. In the code  
> below there is no calculations yet (i'm just trying to solve the  
> import problem). Please.Can anyone give me som suggestions.
> snpSelect<<- function(data, KIND, i){
> rsp<<-cbind(subset(read.table(data, header = TRUE), select=KIND+i))
> rsp
> }
> datan<-matrix(0, nrow=1574, ncol=5)
> for(i in 1:(length(q))){
> datan[,i]<<-snpSelect("c:/program/R/test.txt",KIND,i)
> }
> Best regards Henrik Källberg
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Epi at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-epi



                        |\
_____TTT_____/|   |\  ()
  (___|||___) \|  ()



More information about the R-sig-Epi mailing list