2

I want to import these data

Id_points; x; y; z; remarks  
1; 2562156.119; 1122172.393; 425.627; capteur  
2; 2562155.844; 1122172.412; 420.709;  

I use the following code

S1<-read.csv2('section_raw_data.csv', header=TRUE, sep = ";", dec = ".", fill=TRUE, colClasses=c('integer', 'double', 'double','double','character') )

The resulting dataframe is:

Id_points; x; y; z; remarks  
1; 2562156; 1122172; 425.627; capteur  
2; 2562155; 1122172; 420.709;    

Does anyone have an idea why the first 2 double number are truncated to the decimal ?

Roland
  • 127,288
  • 10
  • 191
  • 288
Eric
  • 23
  • 2

1 Answers1

2

They are only rounded for printing. The internal representation is a double.

S1<-read.csv2(text="Id_points; x; y; z; remarks  
1; 2562156.119; 1122172.393; 425.627; capteur  
2; 2562155.844; 1122172.412; 420.709; ", 
              header=TRUE, sep = ";", dec = ".", fill=TRUE, 
              colClasses=c('integer', 'double', 'double','double','character') )

sprintf("%f",S1$x)
#[1] "2562156.119000" "2562155.844000"
Roland
  • 127,288
  • 10
  • 191
  • 288