sachinthaka.abeywardana at allianz.com.au
2010-Oct-20 02:52 UTC
[R] Accessing table elements and escape characters
Hi All, Are there any escape characters that I should be aware of when using table.read? I don't have any '#' characters in this table. I get the error: A<-read.table("P:/temp.csv",header=TRUE, sep=","); Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 11018 did not have 85 elements but when i open it in excel everything is fine. If I use the fill=TRUE parameter I don't get the error BUT I do end up with weird (and wrong) stuff when I try to access SOME elements. eg. A[2,"ACT_PREFIX"] [1] Levels: C should have been "T"... does this have anything to do with the fact that the separator is a comma, and new line is not included in sep? thanks in advance, Sachin --- Please consider the environment before printing this email --- Allianz - General Insurance Company of the Year 2009+ + Australia and New Zealand Insurance Industry Awards This email and any attachments has been sent by Allianz Australia Insurance Limited (ABN 15 000 122 850) and is intended solely for the addressee. It is confidential, may contain personal information and may be subject to legal professional privilege. Unauthorised use is strictly prohibited and may be unlawful. If you have received this by mistake, confidentiality and any legal privilege are not waived or lost and we ask that you contact the sender and delete and destroy this and any other copies. In relation to any legal use you may make of the contents of this email, you must ensure that you comply with the Privacy Act (Cth) 1988 and you should note that the contents may be subject to copyright and therefore may not be reproduced, communicated or adapted without the express consent of the owner of the copyright. Allianz will not be liable in connection with any data corruption, interruption, delay, computer virus or unauthorised access or amendment to the contents of this email. If this email is a commercial electronic message and you would prefer not to receive further commercial electronic messages from Allianz, please forward a copy of this email to unsubscribe at allianz.com.au with the word unsubscribe in the subject header.
sachinthaka.abeywardana wrote:> > > I get the error: > A<-read.table("P:/temp.csv",header=TRUE, sep=","); > Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, > na.strings, : > line 11018 did not have 85 elements > > but when i open it in excel everything is fine. > >Better open it with NotePad++, show all non-printing characters. Sometimes, a ,"","" instead of ,, creeps in with Excel. Dieter -- View this message in context: r.789695.n4.nabble.com/Accessing-table-elements-and-escape-characters-tp3003176p3003445.html Sent from the R help mailing list archive at Nabble.com.