Re: [R] Read txt File contains character ""
Rui Barradas
ruipbarradas at sapo.pt
Tue Jun 5 13:29:36 CEST 2012
Hello,
Yes, there are ways for R to handle it. You could use readChar/writeChar
after openning the file in binary mode.
Something like,
len <- file.info("test.txt")$size
#len
fc <- file("test.txt", open="rb")
s <- readChar(fc, nchars=len, useBytes = TRUE)
close(fc)
#grep("\032", s)
s <- gsub("\032", " ", s)
"test.txt" is the file I created with the ctrl-z.
Then open="wb"/writeChar with useBytes set to TRUE.
Rui Barradas
Em 05-06-2012 07:42, climmi escreveu:
> Thank you ! Rui Barradas .
>
> Yes, the arrow character "" can not be recoginised by R.
> the character will be treat as a stop command...
> So I replace all the character "" with space, then it works..
> Just want to know is there any way for R to handle it.
>
> Not sure does eveybody able to view the character, it's looks like this.
> http://r.789695.n4.nabble.com/file/n4632369/arrow.png
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Read-txt-File-contains-character-tp4632286p4632369.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list