Dear Himanshu,
Try ?sink() :

data_file.out <- krukal.test(data_file)
sink("~/DATA/results/data_file_out.txt")
data_file.out
sink()


HTH,

Jorge


On Thu, Oct 16, 2008 at 4:31 PM, Himanshu Ardawatia
<[EMAIL PROTECTED]>wrote:

> Hello,
>
> I am running Kruskal-Walis test in R. When I try to save results using
> write.table it gives me the following error :
>
> Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors =
> stringsAsFactors) :
>  cannot coerce class "htest" into a data.frame
>
> The overall code is as follows :
>
> >data_file = read.table("~/DATA.dir/data_file.txt", header=T)
>
> >attach(data_file)
>
> >data_file.out <- krukal.test(data_file)
>
> >write.table(data_file.out, "~/DATA/results/data_file_out.txt")
>
> Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors =
> stringsAsFactors) :
>  cannot coerce class "htest" into a data.frame
> Results do come in data_file.out after analysis as seen below:
>
> >data_file.out
>
>
>    Kruskal-Wallis rank sum test
>
> data:  value by pathway
> Kruskal-Wallis chi-squared = 5.6031, df = 3, p-value = 0.1326
>
>
> I am wondering if I am making a mistake with using write.table (It works
> very well saving results from anova analysis) or is there any other way to
> save results in a file for future use..
>
> Thanks
> Himanshu
> \\
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to