我创建了以下数据框:
VAL1 <- c(0.56972, 0.98741, 0.12547)
VAL2 <- c(0.12345, 0.34532, 0.34234)
DF <- data.frame(time_UTC=seq.POSIXt(as.POSIXct("2007-02-25 00:00"),
to=as.POSIXct("2007-02-26 23:00"),
by="1 hours"), VAL)
head(DF)
time_UTC VAL1 VAL2
1 2007-02-25 00:00:00 0.56972 0.12345
2 2007-02-25 01:00:00 0.98741 0.34532
3 2007-02-25 02:00:00 0.12547 0.34234
4 2007-02-25 03:00:00 0.56972 0.12345
5 2007-02-25 04:00:00 0.98741 0.34532
6 2007-02-25 05:00:00 0.12547 0.34234
如何以科学格式写入文件(write.csv
)其余列(VAL1和VAL2)?
答案 0 :(得分:0)
您可以在写入csv之前使用options(scipen=)
。有关详细信息,请参阅?options
。
options(scipen=-3)
> print(10000)
[1] 1e+04
options(scipen=3)
> print(1e5)
[1] 100000