I have a r-Script in powerbi report in order to save big table to .csv file (1-2 mln records):
One of a column in this table (MOMENT) is timestamp with milliseconds in text format - 20200227100000001
.
Here is the script:
write.table(dataset,"SomePath", quote = FALSE, sep = "","",row.names = FALSE)
But when I use R-Script
it writes this column as a number - 2.02002E+16
.
I've added formaing to this column:
dataset$MOMENT <- format(dataset$MOMENT,scientific = FALSE)
write.table(dataset,"SomePath", quote = FALSE, sep = "","",row.names = FALSE)
But now the R-Script randomly round the value in column MOMENT - instead of 20200227100000001, 20200227100000002, 20200227100000003
I get 20200227100000000
After R-Script
I tried another option like paste, paste0 - non of them resolve the issue.
It looks like R-script works correctly. I tried to reproduce the error in R- Studio and if I input dataset manually the script writes the file correctly. But when I output original dataset from Power BI into R-Studio I get the following
dataset
#SYMBOL VOLUME ID_DEAL MOMENT PRICE SYSTEM TYPE
1 BR53BC0 1 2.570967e+13 2.020023e+16 2.12 5986 B
2 BR53BO0 1 2.570967e+13 2.020023e+16 2.86 5986 B
3 BR53BO0 1 2.570967e+13 2.020023e+16 2.88 5986 B
4 BR53BO0 2 2.570967e+13 2.020023e+16 2.88 5986 B
5 BR53BO0 2 2.570967e+13 2.020023e+16 2.88 5986 B
6 BR53BO0 3 2.570967e+13 2.020023e+16 2.50 5986 B
7 BR53BO0 5 2.570967e+13 2.020023e+16 2.66 5986 B
8 BR53BO0 5 2.570967e+13 2.020023e+16 2.77 5986 B
9 BR53BO0 10 2.570967e+13 2.020023e+16 2.65 5986 B
Power BI shows columns ID_DEAL and MOMENT as "text" but in reality they are numbers
How can I get proper value in .csv
file?