[R-sig-DB] CSV input returns unexpected and unwanted numbers.

Jim Burke j@burke @end|ng |rom e@rth||nk@net
Thu Apr 23 07:38:23 CEST 2009


I am having extreme trouble inputting a csv file.
Previously this worked flawlessly.

Resolution attempts tried. Still problems.
. Rebooting the PC
. Defrag the PC
. Reboot with the shift key down (don't run
  startup items).
. Using old R 2.81

PROBLEM is the first column incorrectly comes
out in scientific notation.

My csv data file named h01369_short_blk.csv.
The data file is below.
===================================
"sctbkey","district"
"480019501001000",8
"480019501001001",8
"480019501001002",8
"480019501001003",8
"480019501001004",8
"480019501001005",8
"480019501001006",8

Using R 9.0 on Windows XP I read it as follows.
The syntax is straight from help(read.csv).
====================================
all_hd_df <- read.csv("h01369_short_blk.csv", header = TRUE,
             sep = ",", quote="\"", dec=".",
             fill = TRUE, comment.char="")

Output
WHY THE SCIENTIFIC NUMBERS? I expected
480019501001000 for the first one
====================================
 > all_hd_df
       sctbkey district
1 4.800195e+14        8
2 4.800195e+14        8
3 4.800195e+14        8
4 4.800195e+14        8
5 4.800195e+14        8
6 4.800195e+14        8
7 4.800195e+14        8

Any suggestions?

Thanks,
Jim Burke




More information about the R-sig-DB mailing list