I'm using read.csv to read in a csv file containing '#' characters. For example, say I'm reading the following file (test.csv): var1,var2,var3 a,b,c d,e#,f g,h,i It outputs:> read.csv("Raw Data\\test.csv")var1 var2 var3 1 a b c 2 d e 3 g h i Warning message: incomplete final line found by readTableHeader on 'Raw Data\test.csv' read.csv appears to be treating '#' as a comment even in input data. Is there a way to turn this interpretation off? Thanks, Mike
Michel Friesenhahn wrote:> I'm using read.csv to read in a csv file containing '#' characters. For > example, say I'm reading the following file (test.csv): > > var1,var2,var3 > a,b,c > d,e#,f > g,h,i > > It outputs: > > >>read.csv("Raw Data\\test.csv") > > var1 var2 var3 > 1 a b c > 2 d e > 3 g h i > Warning message: > incomplete final line found by readTableHeader on 'Raw Data\test.csv' > > read.csv appears to be treating '#' as a comment even in input data. Is there a > way to turn this interpretation off? >From ?read.csv: comment.char: character: a character vector of length one containing a single character or an empty string. Use '""' to turn off the interpretation of comments altogether. Thus, you should use: read.csv("Raw Data\\test.csv", comment.char = "") --sundar
Never mind on my previous question below. read.csv("Raw Data\\test.csv",comment.char="") does it. Mike I'm using read.csv to read in a csv file containing '#' characters. For example, say I'm reading the following file (test.csv): var1,var2,var3 a,b,c d,e#,f g,h,i It outputs:> read.csv("Raw Data\\test.csv")var1 var2 var3 1 a b c 2 d e 3 g h i Warning message: incomplete final line found by readTableHeader on 'Raw Data\test.csv' read.csv appears to be treating '#' as a comment even in input data. Is there a way to turn this interpretation off? Thanks, Mike
Michel Friesenhahn <michel.friesenhahn.b at bayer.com> writes:> I'm using read.csv to read in a csv file containing '#' characters. For > example, say I'm reading the following file (test.csv): > > var1,var2,var3 > a,b,c > d,e#,f > g,h,i > > It outputs: > > > read.csv("Raw Data\\test.csv") > var1 var2 var3 > 1 a b c > 2 d e > 3 g h i > Warning message: > incomplete final line found by readTableHeader on 'Raw Data\test.csv' > > read.csv appears to be treating '#' as a comment even in input data. Is there a > way to turn this interpretation off?comment.char="" -- O__ ---- Peter Dalgaard ??ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907