Dear all
I encountered strange problem with regexpr replacement
I made this character object
str - 02.06.10 12:40
str(str)
chr 02.06.10 12:40
I read in an object which seems to be quite similar
str(as.character(becva$V1)[1])
chr 02.06.10 12:40
However I can not remove
Could you provide us with dput(becva$V1[1])?
Cheers
Joris
On Wed, Jun 2, 2010 at 2:07 PM, Petr PIKAL petr.pi...@precheza.cz wrote:
Dear all
I encountered strange problem with regexpr replacement
I made this character object
str - 02.06.10 12:40
str(str)
chr 02.06.10 12:40
On Wed, 2010-06-02 at 08:07 -0400, Petr PIKAL wrote:
Dear all
I encountered strange problem with regexpr replacement
I made this character object
str - 02.06.10 12:40
str(str)
chr 02.06.10 12:40
I read in an object which seems to be quite similar
Hi
dput(bbb)
c(02.06.10 12:40 , 02.06.10 12:00 , 02.06.10 11:00 ,
02.06.10 10:00 , 02.06.10 09:00 , 02.06.10 08:00 ,
02.06.10 07:00 , 02.06.10 06:00 , 02.06.10 05:00 ,
02.06.10 04:00 , 02.06.10 03:00 , 02.06.10 02:00 ,
02.06.10 01:00 , 02.06.10 00:00 , 01.06.10
You had the wrong case on 'w' and the wrong expression with
[:space:]'; see below
bbb - c(02.06.10 12:40 , 02.06.10 12:00 , 02.06.10 11:00 ,
+ 02.06.10 10:00 , 02.06.10 09:00 , 02.06.10 08:00 ,
+ 02.06.10 07:00 , 02.06.10 06:00 , 02.06.10 05:00 ,
+ 02.06.10 04:00 , 02.06.10
sub(\\s+$, '', bbb,perl=T)
does it for me.
On Wed, Jun 2, 2010 at 3:22 PM, Petr PIKAL petr.pi...@precheza.cz wrote:
Hi
dput(bbb)
c(02.06.10 12:40 , 02.06.10 12:00 , 02.06.10 11:00 ,
02.06.10 10:00 , 02.06.10 09:00 , 02.06.10 08:00 ,
02.06.10 07:00 , 02.06.10 06:00 ,
Hi
thanks. I am puzzled what was wrong. Now even
sub(' +$', '', bbb[1])
works. I am checking water throughput in nearby river and copying data
from internet. So I wonder if there was some change recently as during
floods they update it in about 10 minutes interval.
Regards
Petr
jim holtman
On Wed, 2010-06-02 at 09:22 -0400, Petr PIKAL wrote:
Hi
dput(bbb)
c(02.06.10 12:40 , 02.06.10 12:00 , 02.06.10 11:00 ,
02.06.10 10:00 , 02.06.10 09:00 , 02.06.10 08:00 ,
02.06.10 07:00 , 02.06.10 06:00 , 02.06.10 05:00 ,
02.06.10 04:00 , 02.06.10 03:00 , 02.06.10
Hi Petr,
Matt may very well have been right. As I copied the dput from the mail, any
white space is converted to spaces apparently. Still, it might be possible
the white spaces in your original data are tabs or even newline characters.
You can check that easily with
grep(\t,
Hi
I have original data for which sub(' +$', '', ...) did not work in Excel
so I could try them again.
grep(\t, as.character(becva$V1[1]))
integer(0)
grep(\n, as.character(becva$V1[1]))
integer(0)
and Jim's solutions work as expected
sub('[[:space:]]+$', '', becva$V1[1])
[1] 02.06.10 12:40
10 matches
Mail list logo