Dear R-users,
   
  I have 10 data files in gpr format (dat1.gpr,…dat10.gpr). I want to read in these files one by one in R and then add one extra column (called log) to each data file as below 
                                                                                                                
  data.file=sort(dir(path ='C:/Documents and Settings/ Mina dokument/data1, pattern = ".gpr$",full.names = TRUE))
  num.data.files<- length(data.file)
  num.data.files
   
  i=1
  ### read  one data file
   data<-read.table(file = data.file[i],skip=31,header=T,sep='\t',na.strings="NA")
      
  ### Define the log ratio using values in column 2 resp 8 
     log=as.matrix(log((data[,2])/(data[,8])))
   
  ### append column called ‘log’ to data frame ‘data‘, for the reading data file
     data=cbind(data,log)
   
  ### Read remaining data files
   for (i in 2:num.data.files) {
   
   data<-read.table(file=data.file[i],header=T,skip=31,sep='\t',na.strings="NA") 
         
     log=as.matrix(log((data[,2])/(data[,8])))
     data=cbind(data,log)
                                             }
   
  Now I want to export these files (with an extra column in each) as gpr-files in a folder called data2 but don’t know exactly how to do it, can you help me out ?
    
  Thanks for your help,
   
  Jenny

       
---------------------------------


	[[alternative HTML version deleted]]

