Re: [R] Alter a line in a file.

2011-05-09 Thread Patrick Connolly
On Thu, 05-May-2011 at 06:13AM -0700, Joel wrote: |> |> jholtman wrote: |> > |> > a <- readLines(textConnection('setting1="value1" |> > setting2="value2" |> > setting3="value3" |> > setting4="value4"')) |> > closeAllConnections() |> > # change values |> > ac <- sub('setting4="value4"', 'setting

Re: [R] Alter a line in a file.

2011-05-05 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 05.05.2011 15:13:34: > Joel > Odeslal: r-help-boun...@r-project.org > > 05.05.2011 15:13 > > > jholtman wrote: > > > > a <- readLines(textConnection('setting1="value1" > > setting2="value2" > > setting3="value3" > > setting4="value4"')) > > closeAl

Re: [R] Alter a line in a file.

2011-05-05 Thread Joel
jholtman wrote: > > a <- readLines(textConnection('setting1="value1" > setting2="value2" > setting3="value3" > setting4="value4"')) > closeAllConnections() > # change values > ac <- sub('setting4="value4"', 'setting4="value5"', a) > writeLines(ac, con='myFile.txt') > Problem is that I dont kno

Re: [R] Alter a line in a file.

2011-05-05 Thread Jannis
back as a *.csv file, again using sep='='. Another option would be to read the data as a text string and use regexpressions to replace certain strings. Hope that gets you started Jannis --- Joel schrieb am Do, 5.5.2011: > Von: Joel > Betreff: [R] Alter a line in a file.

Re: [R] Alter a line in a file.

2011-05-05 Thread jim holtman
try this: a <- readLines(textConnection('setting1="value1" setting2="value2" setting3="value3" setting4="value4"')) closeAllConnections() # change values ac <- sub('setting4="value4"', 'setting4="value5"', a) writeLines(ac, con='myFile.txt') On Thu, May 5, 2011 at 8:16 AM, Joel wrote: > Hi all

[R] Alter a line in a file.

2011-05-05 Thread Joel
Hi all R users Ive got a file that contains diffrent settings in the manor of: setting1="value1" setting2="value2" setting3="value3" setting4="value4" . . . What I want to do is open the file and change the value of a specific setting like wanna change setting4="value4" -> setting4="value5" and