[R-SIG-Mac] A .csv question

Dan Putler dan.putler at sauder.ubc.ca
Tue Apr 8 20:22:43 CEST 2008


Hi David,

I'll let others flame you on this.

The question I have is why use the intermediate step of converting the
file to *.csv format? The foreign library allows you to read SPSS *.tab
files directly. The plus to doing it directly is that it has a higher
probability of maintaining the correct variable types then does the use
of a pure text format such as CSV.

Dan

On Tue, 2008-04-08 at 13:11 -0500, David Kaplan wrote:
> Hi,
> 
> No doubt I'm writing to the wrong R list and some cranky person will 
> flame me as a reminder, but I seem to have this problem just on the Mac 
> version of R.  Here is the scenario.   I am using SPSS on the PC to save 
> a file as a .csv.  I then bring this file into R and have it read the 
> file as a .csv.  When I look at the file in Mac Excel, it looks like a 
> regular spreadsheet without commas as I might expect.  When I run the 
> model, I get the message
> 
> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, 
> na.strings,  :
>   scan() expected 'a real', got '3196)'
> 
> 
> The 3196 is the sample size used for this analysis and it is correct.  I 
> can ask it to print the data and the correlation matrix, and everything 
> seems fine.  There are no additional characters (such as a parentheses) 
> in the file.  My students who are doing this analysis for a class 
> assignment do not seem to have a problem on the PC, so I am wondering if 
> anyone has encountered an incompatibility problems.
> 
> Thanks in advance, and I apologize if this is the wrong list.
> 
> David
> 
-- 
Dan Putler
Sauder School of Business
University of British Columbia



More information about the R-SIG-Mac mailing list