[R-SIG-Mac] Unable to read.csv because of special character in file
fisher at plessthan.com
Tue Jan 20 18:07:47 CET 2009
I am trying to read a file that contains the µ (mu character).
readLines is succcessful and shows the following:
read.csv yields the following:
> Error in type.convert(data[[i]], as.is = as.is[i], dec = dec,
> na.strings = character(0)) :
> invalid multibyte string at '<b5>g/mL'
using a text editor, i replaced all occurrences of µ (mu) - at which
point read.csv worked properly.
> R version 2.8.0 (2008-10-20)
> attached base packages:
>  stats graphics grDevices utils datasets methods base
Although my work-around was successful, I am wondering whether there
is some means to accomplish this without editing the source document:
1. is it possible to inform R to read the character in its natural
2. if not, I could execute readLines, then do a gsub (which did not
work - any ideas of how to formulate the regular expression would be
appreciated). then write to a tempfile and read in again (or use a
Dennis Fisher MD
P < (The "P Less Than" Company)
Phone: 1-866-PLessThan (1-866-753-7784)
More information about the R-SIG-Mac