[R] write: write array to file without NAs

Sharpie chuck at sharpsteen.net
Wed Mar 24 22:37:57 CET 2010



jannis-2 wrote:
> 
> Dears,
> 
> does anyone know, how I can get R to save the values of an array in a csv
> like file using write(), but without printing NA to the file? I use ';' to
> seperate the elements, so :
> 
> a=c(1,NA,2,3,3)
> 
> write(a)
> 
> should produce
> 
> 
> 1;;2;3;3
> 
> 
> in the file.
> 
> 
> Thanks in advance!
> 


When using Nabble to post questions, it would be best to use the "New Topic"
button at the top left of the forum view rather than posting in a random
thread.  Your question is completely unrelated to creating multi-paneled pie
charts and this:

  * Confuses those who are following the pie chart thread.

  * Makes your question invisible to people browsing the Nabble forum unless
they happen to look at the pie chart question.  In which case they may get
confused.

Anyway, the answer to your question can be found in the help pages for
write.table():

  ?write.table

Specifically, you may want to play with the arguments "sep" and "na".

Good luck!

-Charlie



-----
Charlie Sharpsteen
Undergraduate-- Environmental Resources Engineering
Humboldt State University
-- 
View this message in context: http://n4.nabble.com/Multi-panel-Pie-Charts-tp1687026p1689863.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list