[R] Reading Strings in R

Lorenzo Isella lorenzo.isella at gmail.com
Mon Oct 4 13:04:55 CEST 2010


Dear All,
I know this must be a one-liner, but I am experiencing problems.
I need to read lists of long integers stored on a text files, i.e. which 
reads like

"7359700484475972"
"7359700484475972"
"0"
"7359700484475972"
"0"
"0"
"0"
"97189954101318722"
"0"
"0"
"7811896690636354"
"7359700490636354"
"0"
"0"
"0"
"7811896684475972"
"7811896684475972"
"7811896690636354"
"8447597298304052"
"7359700484475972"
"0"
"7359700498304052"
"7359700498304052"
"7359700498304052"
"0"
"7359700498304052"
"7359700484475972"
"7359700484475972"

Now, for me every integer is just a symbol, i.e. the ID of some object 
and I simply need to find out how many times and where it occurs in this 
file.
Bottom line: I would like to read this file directly as a string to 
ensure I will not have any trouble of integer overflow or rounding error.
I tried readLines, but I cannot get rid of \n.
Any help is appreciated.
Cheers

Lorenzo



More information about the R-help mailing list