Given a csv file from this location

Airports<-"http://www.ourairports.com/data/airports.csv";

download.file(Airports,basename(Airports))


airports <-read.csv("airports.csv",encoding="UTF-8")

> airports[1,]

    id ident     type              name latitude_deg longitude_deg
elevation_ft continent iso_country iso_region municipality scheduled_service

1 6523   00A heliport Total Rf Heliport      *40.0708      -74.9336 *
  11      <NA>          US      US-PA     Bensalem                no

  gps_code iata_code local_code home_link wikipedia_link keywords

1      00A                  00A


And the precision is lost which we can show by using readLines:


fred<-readLines("airports.csv")

> fred[2]
[1] "6523,\"00A\",\"heliport\",\"Total Rf Heliport\",*
40.07080078125,-74.9336013793945*
,11,\"NA\",\"US\",\"US-PA\",\"Bensalem\",\"no\",\"00A\",,\"00A\",,,"


I tried various approaches, using colClasses, switching to read.tables,
specifying dec="."


I tested read.csv and it does preserve precision on my test case, but not on
this data.


Ideas?

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to