Use scan whith what='' or read.table with colClasses='character'. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111
> -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Lorenzo Isella > Sent: Monday, October 04, 2010 5:05 AM > To: r-help > Subject: [R] Reading Strings in R > > 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 > > ______________________________________________ > 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. ______________________________________________ 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.