Silvia Lomascolo wrote:
refdata =
read.table("K:\\MerchantData\\RiskModel\\refund_distribution.csv", header
= TRUE)
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
:
line 1 did not have 42 elements
refdata =
read.table("K:\\MerchantData\\RiskModel\\refund_distribution.csv")
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
:
line 2 did not have 42 elements
R interprets that you have 42 columns from the variable names. Do you? See
if removing spaces between column names helps (e.g., "week.1" instead of
"week 1"). Also, because yours is a csv file, fields are separated by
comas. You can either use the "read.csv" command instead of the
"read.table" (see ?read.table for details), or add the argument sep="," to
tell R that fields are separated by comas. You might also need to specify,
if you have empty cells, what to do with them (e.g., na.strings="")
You are of course right about the NA's (missing values, empty cells) as
well as the possible blanks in the column names. It might nevertheless
be a good idea for him to at least submit a few of the lines at the top
of the file. A .csv file as generated by Excel on Windows is not
necessarily comma-separated. That depends on the "list separator"
setting under "Regional Language Settings" found in the Control Panel.
On my machine, the list separator is a semicolon for a .csv file. The
reason is simple, in Norway, the standard decimal separator is a comma,
and you do not want to confuse the system too much. So, that particular
point is dependent on the settisngs for his locale (language, country).
Tom
--
+----------------------------------------------------------------+
| Tom Backer Johnsen, Psychometrics Unit, Faculty of Psychology |
| University of Bergen, Christies gt. 12, N-5015 Bergen, NORWAY |
| Tel : +47-5558-9185 Fax : +47-5558-9879 |
| Email : [EMAIL PROTECTED] URL : http://www.galton.uib.no/ |
+----------------------------------------------------------------+
______________________________________________
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.