[R] read.xls - ampersand different in XLS and XLSX

Zev Ross zev at zevross.com
Thu Mar 8 21:34:48 CET 2012


Hi All,

I'm using read.xls from GDATA and it seems to be treating ampersands 
differently depending on whether the source file is an XLS or the more 
current XLSX. Ampersands from an XLSX become &.

As a test I have a csv:

write.csv(data.frame(a=c("JERRY", "DICK & LINDA")), "ampersand.csv", 
row.names=F)

I manually save as an XLS and XLSX in Excel. With the XLS it reads the 
data back in perfectly. With the XLSX the ampersand is converted to an &

Can someone explain how to fix (I'm using Windows 7, 64bit, R 2.12.2, 
GDATA 2.8.1) .

(This also happens if I explicitly identify the path to strawberry Perl).

Thank you, Zev


 > read.xls("ampersand.xlsx")
                   a
1            JERRY
2 DICK & LINDA

 > read.xls("ampersand.xls")
               a
1        JERRY
2 DICK & LINDA



More information about the R-help mailing list