Re: [R] How to save results from chisq.test or mantelhaen.test to file

2007-07-01 Thread Chuck Cleland
[EMAIL PROTECTED] wrote:
 Hi,
 
 I am new to these functions. I'm wondering if there is anyway to save the 
 entire results (all attributes of the result object) from the chisq.test or 
 mantelhaen.test functions? For example, from chisq.test function, you will 
 have statistic, parameter, p.value, expected, etc. in the result list. How 
 can I save all of them in one shot to, says, a text file or csv file? Thank 
 you.
 
 - adschai

  You could unlist() the result, coerce it to a data frame, then use
write.table().  For example, something like this:

write.table(as.data.frame(t(unlist(chisq.test(InsectSprays$count  7,
InsectSprays$spray, quote=FALSE)

or

write.table(as.data.frame(unlist(chisq.test(InsectSprays$count  7,
InsectSprays$spray))), quote=FALSE)

 __
 R-help@stat.math.ethz.ch 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.

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
R-help@stat.math.ethz.ch 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.


Re: [R] How to save results from chisq.test or mantelhaen.test to file

2007-07-01 Thread adschai
Thank you Chuck. This is really neat! I just learned that we can unlist thing. 
- adschai- Original Message -From: Chuck Cleland Date: Sunday, July 1, 
2007 4:53 amSubject: Re: [R] How to save results from chisq.test or 
mantelhaen.test to fileTo: [EMAIL PROTECTED]: r-help@stat.math.ethz.ch [EMAIL 
PROTECTED] wrote:  Hi,I am new to these functions. I'm wondering if 
there is anyway  to save the entire results (all attributes of the result 
object)  from the chisq.test or mantelhaen.test functions? For example,  from 
chisq.test function, you will have statistic, parameter,  p.value, expected, 
etc. in the result list. How can I save all  of them in one shot to, says, a 
text file or csv file? Thank you.- adschai   You could unlist() the 
result, coerce it to a data frame, then use write.table().  For example, 
something like this:  
write.table(as.data.frame(t(unlist(chisq.test(InsectSprays$count   7, 
InsectSprays$spray, quote=FALSE)!
   or  write.table(as.data.frame(unlist(chisq.test(InsectSprays$count  7, 
   InsectSprays$spray))), quote=FALSE)   
   __  R-help@stat.math.ethz.ch 
   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.  --  
   Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New 
   York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, 
   F) fax: (917) 438-0894

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


Re: [R] How to save results from chisq.test or mantelhaen.test to file

2007-07-01 Thread ronggui
Maybe _dput_ is another way, and you can use _dget _ to get it back.

2007/7/1, Chuck Cleland [EMAIL PROTECTED]:
 [EMAIL PROTECTED] wrote:
  Hi,
 
  I am new to these functions. I'm wondering if there is anyway to save the 
  entire results (all attributes of the result object) from the chisq.test or 
  mantelhaen.test functions? For example, from chisq.test function, you will 
  have statistic, parameter, p.value, expected, etc. in the result list. How 
  can I save all of them in one shot to, says, a text file or csv file? Thank 
  you.
 
  - adschai

   You could unlist() the result, coerce it to a data frame, then use
 write.table().  For example, something like this:

 write.table(as.data.frame(t(unlist(chisq.test(InsectSprays$count  7,
 InsectSprays$spray, quote=FALSE)

 or

 write.table(as.data.frame(unlist(chisq.test(InsectSprays$count  7,
 InsectSprays$spray))), quote=FALSE)

  __
  R-help@stat.math.ethz.ch 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.

 --
 Chuck Cleland, Ph.D.
 NDRI, Inc.
 71 West 23rd Street, 8th floor
 New York, NY 10010
 tel: (212) 845-4495 (Tu, Th)
 tel: (732) 512-0171 (M, W, F)
 fax: (917) 438-0894

 __
 R-help@stat.math.ethz.ch 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.



-- 
Ronggui Huang
Department of Sociology
Fudan University, Shanghai, China

__
R-help@stat.math.ethz.ch 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.


[R] How to save results from chisq.test or mantelhaen.test to file

2007-06-30 Thread adschai
Hi,

I am new to these functions. I'm wondering if there is anyway to save the 
entire results (all attributes of the result object) from the chisq.test or 
mantelhaen.test functions? For example, from chisq.test function, you will have 
statistic, parameter, p.value, expected, etc. in the result list. How can I 
save all of them in one shot to, says, a text file or csv file? Thank you.

- adschai

__
R-help@stat.math.ethz.ch 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.