On Feb 7, 2012, at 12:39 AM, David Winsemius wrote:
On Feb 7, 2012, at 12:22 AM, Hasan Diwan wrote:I'm trying to read in a CSV, with lines looking like: HEADER, Latitude DecDeg, Latitude Hemisphere, Longitude DecDeg, Longitude Hemisphere, Speed knots, Bearing Degrees, fixQualityGga, noOfSatGga, altGga, heightGga, selectionGsa, fixGsa, pdopGsa, hdopGsa, vdopGsa, noOfSatGsv, Time, *checkSum $GPS, 3747.0224, N, 12223.4522, W, 0.36, 348.21, 1, 3, 4.01, 175.5, -25.2, A, 2, 4.14, 4.01, 1.00, 00, 1328565081, *0E $GPS, 3747.0894, N, 12223.4684, W, 0.44, 348.21, 1, 4, 1.65, 14.4, -25.2, A, 3, 1.92, 1.65, 0.99, 00, 1328565082, *3D $GPS, 3747.0897, N, 12223.4685, W, 0.13, 348.21, 1, 6, 1.23, 14.0, -25.2, A, 3, 1.57, 1.23, 0.98, 00, 1328565083, *32 ... using read.csv and am getting the error message in the subject line ("Duplicate row.names not allowed"). Any idea what is causing this?count.fields( textConnection("HEADER, Latitude DecDeg, Latitude Hemisphere, Longitude DecDeg, Longitude Hemisphere, Speed knots, Bearing Degrees, fixQualityGga, noOfSatGga, altGga, heightGga, selectionGsa, fixGsa, pdopGsa, hdopGsa, vdopGsa, noOfSatGsv, Time, *checkSum + $GPS, 3747.0224, N, 12223.4522, W, 0.36, 348.21, 1, 3, 4.01, 175.5, -25.2, A, 2, 4.14, 4.01, 1.00, 00, 1328565081, *0E + $GPS, 3747.0894, N, 12223.4684, W, 0.44, 348.21, 1, 4, 1.65, 14.4, -25.2, A, 3, 1.92, 1.65, 0.99, 00, 1328565082, *3D + $GPS, 3747.0897, N, 12223.4685, W, 0.13, 348.21, 1, 6, 1.23, 14.0, -25.2, A, 3, 1.57, 1.23, 0.98, 00, 1328565083, *32")+ ) [1] 25 20 20 20 The spaces shouldn't be in field names.More column headings than data, eh? You probably need to edit your header so it doesn't have "extra stuff". And remove the leading "$GPS" which seems to be getting interpreted as row.names.read.csv(textConnection(" Latitude_DecDeg, Latitude_Hemisphere, Longitude_DecDeg, Longitude_Hemisphere, Speed_knots, Bearing_Degrees, fixQualityGga, noOfSatGga, altGga, heightGga, selectionGsa, fixGsa, pdopGsa, hdopGsa, vdopGsa, noOfSatGsv, Time, check + 3747.0224, N, 12223.4522, W, 0.36, 348.21, 1, 3, 4.01, 175.5, -25.2, A, 2, 4.14, 4.01, 1.00, 00, 1328565081, *0E + 3747.0894, N, 12223.4684, W, 0.44, 348.21, 1, 4, 1.65, 14.4, -25.2, A, 3, 1.92, 1.65, 0.99, 00, 1328565082, *3D + 3747.0897, N, 12223.4685, W, 0.13, 348.21, 1, 6, 1.23, 14.0, -25.2, A, 3, 1.57, 1.23, 0.98, 00, 1328565083, *32")) Latitude_DecDeg Latitude_Hemisphere Longitude_DecDeg Longitude_Hemisphere 3747.0224 N 12223.45 W 0.36 3747.0894 N 12223.47 W 0.44 3747.0897 N 12223.47 W 0.13 Speed_knots Bearing_Degrees fixQualityGga noOfSatGga altGga heightGga 3747.0224 348.21 1 3 4.01 175.5 -25.2 3747.0894 348.21 1 4 1.65 14.4 -25.2 3747.0897 348.21 1 6 1.23 14.0 -25.2 selectionGsa fixGsa pdopGsa hdopGsa vdopGsa noOfSatGsv Time check 3747.0224 A 2 4.14 4.01 1.00 0 1328565081 *0E 3747.0894 A 3 1.92 1.65 0.99 0 1328565082 *3D 3747.0897 A 3 1.57 1.23 0.98 0 1328565083 *32
You could also set row.names=NULLread.csv(textConnection("HEADER, Latitude DecDeg, Latitude Hemisphere, Longitude DecDeg, Longitude Hemisphere, Speed knots, Bearing Degrees, fixQualityGga, noOfSatGga, altGga, heightGga, selectionGsa, fixGsa, pdopGsa, hdopGsa, vdopGsa, noOfSatGsv, Time, *checkSum + $GPS, 3747.0224, N, 12223.4522, W, 0.36, 348.21, 1, 3, 4.01, 175.5, -25.2, A, 2, 4.14, 4.01, 1.00, 00, 1328565081, *0E + $GPS, 3747.0894, N, 12223.4684, W, 0.44, 348.21, 1, 4, 1.65, 14.4, -25.2, A, 3, 1.92, 1.65, 0.99, 00, 1328565082, *3D + $GPS, 3747.0897, N, 12223.4685, W, 0.13, 348.21, 1, 6, 1.23, 14.0, -25.2, A, 3, 1.57, 1.23, 0.98, 00, 1328565083, *32"), row.names=NULL) row.names HEADER Latitude.DecDeg Latitude.Hemisphere Longitude.DecDeg 1 $GPS 3747.022 N 12223.45 W 2 $GPS 3747.089 N 12223.47 W 3 $GPS 3747.090 N 12223.47 W Longitude.Hemisphere Speed.knots Bearing.Degrees fixQualityGga noOfSatGga altGga 1 0.36 348.21 1 3 4.01 175.5 2 0.44 348.21 1 4 1.65 14.4 3 0.13 348.21 1 6 1.23 14.0 heightGga selectionGsa fixGsa pdopGsa hdopGsa vdopGsa noOfSatGsv Time 1 -25.2 A 2 4.14 4.01 1.00 0 1328565081 2 -25.2 A 3 1.92 1.65 0.99 0 1328565082 3 -25.2 A 3 1.57 1.23 0.98 0 1328565083
X.checkSum 1 *0E 2 *3D 3 *32
-- Sent from my mobile device Envoyait de mon portable ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.David Winsemius, MD West Hartford, CT ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD West Hartford, CT ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

