I want to use write.table to produce an output with 18 decimal places, in numeric format (for those columns that are Numeric) containing no NA values... For Example, in the table below - The Value Column would be classed as Numeric data type and would have 18 decimal places.
Country, Category, Volume
Germany, Food, 123456.123456789123456789
Poland, Drink, 654321.987654321987654321
Latvia, Food
The Code Below would produce an output file... and in this file it seems that R decides how many decimal places are saved (not Enough for my purposes).
write.table(myDF,file = "TEST", row.names = FALSE, dec = ".",col.names =
TRUE, na = "", sep = "|", quote = FALSE)
The Code Below does produce an output file with 18 decimal places - but the problem with using the format function is that the value column would now be character data type. This also produces NA strings (Latvia in the example above was originally blank is now a NA but in character format - which write.table cannot remove from the final file.
write.table(format(myDF,digits=18,scientific = FALSE),file =
"TEST", row.names = FALSE, dec = ".", col.names =
TRUE, na = "", sep = "|", quote = FALSE)
Please advise on how to proceed? Many thanks!