Hi there,

I use R and I would like to be able to modify a file .txt "init_file" like this 
one :

# ---------------------------------------------------------------------------- #
# Parameters A
# ---------------------------------------------------------------------------- #
# Parameter 1
PA1 = 15

# Parameter 2
PA2 = 3

# Parameter 3
PA3 = 2

# ---------------------------------------------------------------------------- #


# ---------------------------------------------------------------------------- #
# Parameters B
# ---------------------------------------------------------------------------- #

# Parameter 1
PB1 = 6

...

I have in a first time stocked the values I want to attribute to each parameter 
and so I would like to create several config files like the first one but with 
different values for each parameter. I have an array like this one 

              PA1      PA2       PA3     PB1     ....
j=1           12        2         1        5
j=2           10        3         2        4
j=3           11        4         3        6
...



To create each file I use :

for (j in 1:Nb_config_file)
        {
                file.copy("fichier_init",paste("Config_file",j,sep=""))
         }

How can I do to search in each config file j created to modify the values of 
the parameters according to the j-th row of the array?
I thought about looking for the lines "'Parameter' = Value" and modify this 
line in "'Parameter' = New_value" but I don't find any function to know the 
location of each string in my config_file...

I could also use such a function to modify the format of the date to replace 
the ":" by something which can be used in a Directory/file name.


Thanks you for your time and for your future help =)


Cheers

Romain

____________________________________________________

Vous aussi bénéficiez d'1 Go de stockage gratuit en ligne avec Voila  
http://macle.voila.fr

______________________________________________
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.

Reply via email to