Re: [R] gsub -> replace substring in column

2012-08-22 Thread PIKAL Petr
Hi One more comment > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of David Winsemius > Sent: Thursday, August 23, 2012 2:22 AM > To: Paula Cafeld > Cc: r-help@r-project.org > Subject: Re: [R] gsub -&

Re: [R] gsub -> replace substring in column

2012-08-22 Thread David Winsemius
On Aug 22, 2012, at 10:24 AM, Paula Cafeld wrote: Hi all, please excuse- I'm a complete newbie to R, so it's possible my question was asked a thousand times before, but I don't get it :-( I imported a CSV file via: x=read.csv("test.csv",header=TRUE,sep="\t") In a column there are values w

Re: [R] gsub -> replace substring in column

2012-08-22 Thread arun
Hi, Try this: x<-read.table(text=" 1 GPS_LATITUDE 2    53.51982466427600 3   51.520379571037000 4   53.520745152837800 5   51.521750487103766 6    53.52067987059652 7   53.519504773664345 8    51.51861690180330 9   51.519100010776675 10   51.51905431150669 11    51.5193415632712 12   53.519

Re: [R] gsub -> replace substring in column

2012-08-22 Thread MacQueen, Don
This is untested, but I suspect you should try x[[9]] instead of x[9] If you want to replace the original values with the modified values, then you will need something like, x[[9]] <- gsub(".",",",x[[9]],fixed=T) The difference between single brackets [] and double brackets [[]] is importa

Re: [R] gsub -> replace substring in column

2012-08-22 Thread Rui Barradas
Hello, Your earch pattern is wrong, it should be gsub("\\.", ", ", x[9]) I find x[9] a bit strange, by the way. Specially if the column vector name is V16. Anyway, try the instruction above and if it doesn't work, post a data example with dput( head(x, 16) ) # paste the output of this in