[英]One dataframe column not respecting decimal-delimiter character in write.table
I'm trying to output data in R using the following command: 我正在尝试使用以下命令在R中输出数据:
write.table(df,file=OutputFile,append=FALSE,row.names=FALSE,col.names=FALSE,sep="\t",dec=",")
df looks like:
col1 col2 col3
1 89.6 89.3 89.8
2 89.7 88.9 90.5
3 89.8 88.5 91.1
OutputFile contains the path to where I want to write df. OutputFile包含我要写入df的路径。 My problem is that the output looks like this:
我的问题是输出看起来像这样:
89.6 89,3 89,8
89.7 88,9 90,5
89.8 88,5 91,1
The first column still has a dot as decimal delimiter, instead of a comma. 第一列仍然有一个点作为小数点分隔符,而不是逗号。 Does anyone know what could cause this?
有谁知道是什么原因造成的? I am using version 3.2.1.
我正在使用3.2.1版。
Thank you very much, lukeA! 非常感谢,lukeA! You are right, the first column contains an Arima-forecast.
是的,第一列包含Arima预测。 str(df) showed
str(df)显示
'data.frame': 3 obs. 'data.frame':3个观察点。 of 3 variables:
3个变量:
$ col1 : Time-Series from 2015 to 2016: 89.6 89.7 89.8 $ col1:从2015年到2016年的时间序列:89.6 89.7 89.8
$ col2 : num 89.3 88.9 88.5 $ col2:数字89.3 88.9 88.5
$ col3: num 89.9 90.5 91.1 $ col3:数字89.9 90.5 91.1
Wrapping as.numeric() around the forecast when filling df did the trick. 在填充df时,将as.numeric()包裹在预测周围就可以了。 Thanks again.
再次感谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.