There are similar posts, but none of them actually explained what is this error cause by?
I would like to obtain input in this .csv format: separator ";" and decimal "."
Parameter;Intensitaet;Wert
se;1;0.027
se;1;0.024
se;1;0.021
se;1;0.018
se;1;0.015
se;1;0.012
What I get is:
Parameter;Intensitaet;Wert
se;2;0,0572
se;2;0,2
se;2;0,1
se;2;0,4
se;2;0,0795
The have tried various versions of this code:
> write.csv(final, "SEmurgang.csv", row.names = F, quote = F, sep = ";")
Warning message:
In write.csv(final, "SEmurgang.csv", row.names = F, quote = F, sep = ";") :
Versuch ignoriert 'sep' zu setzen
> write.csv2(final, "SEmurgang.csv", row.names = F, quote = F, dec=".")
Warning message:
In write.csv2(final, "SEmurgang.csv", row.names = F, quote = F, :
Versuch ignoriert 'dec' zu setzen
However, I always get the same error. How can I fix it?
Decimal and separator are hard coded in write.csv2
.
write.csv2 uses a comma for the decimal point and a semicolon for the separator, the Excel convention for CSV files in some Western European locales.
If they do not suit you, you are better of using write.table
.
write.table
is the basic method and write.csv
and kin are just a handy wrappers.
Using write.table
works for me.
xy <- data.frame(Parameter = rep("se", 5),
Intensitaet = rep(1, 5),
Wert = rnorm(5))
xy
Parameter Intensitaet Wert
1 se 1 -1.014570811
2 se 1 -0.680449323
3 se 1 -0.223736133
4 se 1 0.004270224
5 se 1 0.607427274
write.table(xy, file = "test.txt", row.names = FALSE, dec = ".", sep = ";",
quote = FALSE)
system("cat test.txt")
Parameter;Intensitaet;Wert
se;1;-1.01457081089331
se;1;-0.68044932280397
se;1;-0.223736133320336
se;1;0.0042702235293986
se;1;0.607427274081342
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With