Re: [R] type.convert error with read.csv function

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Wed 20 Apr 2005 - 07:54:38 EST

On Tue, 19 Apr 2005, Ivan Alves wrote:

> Dear all,
>
> I obtained and successfully compiled R 2.1.0 on Mac OSX 10.3.9. The
> flags used for configuration are:
>
> ./configure --enable-utf8 --enable-R-shlib --with-blas='-framework
> vecLib' --with-lapack --with-aqua
> --with-tcl-config=/Library/Frameworks/Tcl.framework/tclConfig.sh
> --with-tk-config=/Library/Frameworks/Tk.framework/tkConfig.sh
> TCLTK_LIBS='-framework Tcl -framework Tk'
> TCLTK_CPPFLAGS='-I/Library/Frameworks/Tcl.Framework/Headers
> -I/Library/Frameworks/Tk.Framework/Headers'
>
> A straight-forward read.csv[] function returns the following error:
>
> > map.plain <- read.csv("~/Projects/ProjectMap/plain.csv", na.strings =
> ".")
> Error in type.convert(data[[i]], as.is = as.is[i], dec = dec,
> na.strings = character(0)) :
> invalid multibyte string
>
> I had used the exact command with R 2.0.1 compiled with almost exactly
> the same configuration (except the utf8 support) and had no errors.
> Could you please enlighten this unknowledgeable soul as to the nature
> of the problem? I searched in R-help digest to no avail. Thank you
> very much in advance.

First port of call is the manuals. Since this is a new version of R, you need to read the new versions.

The issue is that you are in a UTF-8 locale, and your file is not in UTF-8. You need to tell R what encoding it is in: please read the manual `R Data Import/Export'. (Discussed in section 2.1 in the HTML version.)

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Wed Apr 20 07:58:34 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:17 EST