[R] File Reading Problem

Jiming Yu jimingyu at princeton.edu
Mon Sep 1 23:26:43 CEST 2003


Dear all,
    I am trying to read characters byte by byte(in their ASCII codes) from a
file(already transferred from text file to a file of ASCII codes, by C
language). I am using scan() function. But it seems that this is impossible.
    If I read data as 'character' type, data are read word by word,
separated by spaces(though in default setting, sep=""). e.g. if a file
contains "This is a book.", Then it reads "This", "is", "a", "book.", not
"T", "h", "i", "s", etc(as I wanted it to).
    If I read data as 'integer' type from the file which contains all ASCII
codes of the original file, e.g. if a file contains "This is a book.", Then
it reads "T", " ", "i", " ", "a", " " , "b", which are initials of all words
and all spaces, not "T", "h", "i", "s", etc(as I wanted it to).
    If anybody has a solution, please let me know. I'd really appreciate
your help. Thank you very much!
                Jiming



Jiming Yu
Information Sciences and Systems Group
Department of Electrical Engineering
Princeton University

Email:  jimingyu at princeton.edu
Office:  609-258-4634
Cell:     609-933-6850




More information about the R-help mailing list