> Hi:
> I have a data file in the following format. The first three digits stand for the ID of a respondent such as 402, 403. Different respondents may have the same ID. Followed the ID are 298 single digit number ranging from 1 to 5. My question is how to read this data file into R. I tried "scan" and "read" but they do not work because the numbers in the file are not separated. Any suggestions?
> Thank you!
>

The answers provided to date (read.fwf()) look just fine. I thought I'd mention that you could always pre-process the data file in any text editor to insert commmas or tabs between every number (other than that leading 3-digit number) and then use scan() or read.csv()

Carl

______________________________________________
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.

Reply via email to