[R] save txt file

Daniel Malter daniel at umd.edu
Thu Sep 24 09:52:34 CEST 2009


any r manual helps here, and there are many easy ways to do it.

?cbind
?matrix
?data.frame

If you need it in rows, matrix transposition helps, or add the byrow
argument when using the "matrix" function (or by.row; I don't remember from
the top of my head). ?dim could also do the  job if you make one vector out
of a and b.

Best,
Daniel


-------------------------
cuncta stricte discussurus
-------------------------

-----Ursprüngliche Nachricht-----
Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im
Auftrag von Eiger
Gesendet: Wednesday, September 23, 2009 5:37 PM
An: r-help at r-project.org
Betreff: [R] save txt file


Hi, I have 2 questions:


Question 1:

I define 2  variables: "a", "b":

> a<-rbinom(4,10,0.8)
output:
[1] 9 7 8 8

> b<-rbinom(2,6,0.7)
output:
[1] 4 5

if I write:
> write.table(a, file = "filename", etc. etc. .... )
it save only the values of variable "a".

There is a way to save in a .txt file the values  "a" and "b" as consecutive
data?  (but I would use many variables..) ..like this:

9
7
8
8
4
5

Question 2:
is possible save data as rows?  
(9 7 8 8 4 5)

thank's

Eiger


--
View this message in context:
http://www.nabble.com/save-txt-file-tp25531307p25531307.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list