Hello all,

I'm using the following scan() parameters on a tab-separated text file that was 
generated by R. 

temp_file <- scan(file = outfile, sep="\t", what = character(), skip = 1, 
nlines = 1)

The problem is that within some cells, there are cases where there are three 
frontslashes ( /// ). However, the file itself is tab-separated, and the exact 
problem is that even if I specify sep="\t" in the argument to scan(), whenever 
it encounters a /// it overrides the tab separation, and uses the /// as the 
separator. Then within that column, I see a bunch of /t in the output, and no 
///. There are also some cells with two frontslashes ( // ), but scan handles 
them just fine. 

I've tried many, many other combinations of parameters, but have not found the 
right one. 

I know this shouldn't be a problem, b/c read.csv() and read.table() call 
scan(), and when calling them, such as:

abc <- read.table(outfile, sep="\t", header=T)

...I don't have the problem. The /// show up in the output verbatim, and the /t 
are used as proper delimiters. 

If anyone can tell me which parameter I am missing in scan(), I would be very 
grateful. I'd prefer not to have to use make.names() to handle the slashes. 

Thanks in advance for any help,
-Ken
 
_________________________________________________________________
[[replacing trailing spam]]

ilnews
        [[alternative HTML version deleted]]

______________________________________________
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