[R] Variables in a Tabular form. easily saved in a txt file
jrkrideau at inbox.com
Thu Jul 26 17:49:17 CEST 2012
It is really not clear what you want without some idea of what the variables and data look like.
However if the data is in a couple of vectors you could try something like this
postal <- c(2134, 54, 12)
superb <- c(2,5,54433)
cities <- c("City1", "City2", "City3")
hds <- c("Postal.Code", "Superb")
mat <- matrix( c(postal, superb), nrow=3)
colnames(mat) <- hds
rownames(mat) <- cities
dat1 <- data.frame(cities, postal, superb)
names(dat1) <- c("city", "postal.code", superb)
Both of these can be save to a text file using
Kingston ON Canada
> -----Original Message-----
> From: alaios at yahoo.com
> Sent: Thu, 26 Jul 2012 04:29:07 -0700 (PDT)
> To: r-help at r-project.org
> Subject: [R] Variables in a Tabular form. easily saved in a txt file
> Dear all,
> I would like to save few variable-names with their values in a tabular
> form, with that I mean
> that files can be printed easily in R in a tabular form and also saved in
> a ascii file that when one opens it see also the variables in a nice
> tabular format.
> IS that possible? Below a small example of how should look results in R
> and in a txt file.
> Postal Code | Superb
> City1 | 2134 | 2
> City2 | 254 | 5
> City3 | 12 | 54433
> I am ok if you can give me some hard coded example to try.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!
More information about the R-help