2

When i make a data frame in R, e.g. like this:

x <- data.frame(sum=c(0.00, 0.00, 1363.31, 27663.58, 27663.58), ID=1:5)

I can save it with write.csv

write.csv(x, "x.csv")

But when i open the x.csv file in arcmap it reads the three last numbers in x$sum as < Null >. Why is this, and is there a way to ensure that ArcMap reads numbers correctly?

A workaround is to open it in excel and save it as a worksheet, but there has to be an easier way.

I dont think its the decimal separator - when I open it in notebook it looks like this:

"","sum","ID"
"1",0,1
"2",0,2
"3",1363.31,3
"4",27663.58,4
"5",27663.58,5

1

It isn't an R issue, is how your PC interprets decimal symbol. If you have a different decimal symbol than ., you'll get NULL value in ArcMap:

null

Go to Control Panel/Regional and Language Options/Format tab and change decimal separator. An useful configuration is:

  • Decimal symbol: .
  • Digit grouping symbol: ,
  • List separator: ,

After apply configuration, open again ArcMap and import .csv again, you'll get:

enter image description here

  • My settings were already as you suggest. So its not that. Is there a decimal separator option in ArcMap? – Jeppe Olsen Jan 11 '17 at 14:25
  • No, ArcMap takes local regional and language settings. Try changing language to "English (United States)", then apply and restart ArcMap. – aldo_tapia Jan 11 '17 at 15:07
  • I changed the language, but its still not working. I have started creating the shapefiles in R instead, but would be nice to be able to do both without having to open the file in excel and and saving it as a worksheet. – Jeppe Olsen Jan 16 '17 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.