Hi there -

 

I have been trying to generate some simple stats and save the results to
a file. My data looks like this:

 

x          y          z          exp

0          3          5          1

2          11         10         1

4          4          5          1

7          6          4          1

11         1          2          2

5          7          1          2

3          3          3          2

1          6          1          2

 

and the script I ran is:

 

===========

data <- read.table("c:\\R\\data.txt", header=T)

attach(data)

m <- tapply(x, exp, mean)

write.table(m, file="c:\\R\\tst.txt", col.names=T, row.names=F, quote=F,
append = FALSE)

============

 

I'd like to write the full contents of m:

 

  1    2 

3.25 5.00

 

to a file, but the write.table call gives me an error: 

 

Error in as.data.frame.default(x[[i]], optional = TRUE) : 

        can't coerce array into a data.frame

 

Can anyone tell me what the most convenient/flexible way is to write
data.frames?

 

Thanks - Ton

 

Ton van Daelen, PhD
Director, Application Support
Tel: (858) 279-8800 ext 217
Fax: (858) 279-8804

Web: www.scitegic.com
SciTegic Inc. - ask more of your data

 

 


	[[alternative HTML version deleted]]


