loops - repeat operation to different data set in R language -
i have data set have 5 columns (column, 0 4) named data1. add column 2, 3 , normalize result of data1. following :
final_data = my_norm_function(data1[2]+data1[3]) write.table(final_data)
but want same operation other data set, data2
, data3
, data4
, etc -- 2 columns out each data set , add them together, normalize result , save. there loop can use this? saved data set corresponding data1
, data2
, data3
.
sure, here's for
loop version:
for(i in c("vector of file names")){ datain<-read.table(i) final_data = my_norm_function(datain[2]+datain[3]) write.table(final_data,file=paste("final_data",i)) }
Comments
Post a Comment