On 12/17/2010 08:13 PM, Mauricio Zambrano wrote:
Dear list,

I need to change a value within a particular line of a plain text file
with characters and numbers, and I haven't found any way of doing this
by using R.

What I have a is a file that doesn't have tabular data (so, I think
that 'read.table' or 'read.delim' are not the right tools for this),
but some text, and I now exactly the row that has to be modified and
the columns within that row that have to be changed with a new
numerical value.

I don't' know any way of reading a text file line by line in R, and
this is the only solution in R that I have figured out so far...

Any idea about how can I do this ?.

Hi Mauricio,
Have a look at the readLines function. That will get the text into R, you can then use "sub" or something to change the offending line and then write the file out again.

Jim

______________________________________________
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