Tiago V. Pereira
2012-Jan-23 17:32 UTC
[R] How can I access information stored after I run a command in R?
Dear all,
Supposed I run the following command:
###############################
#install.packages("Rassoc", dependencies=TRUE)
library("Rassoc")
ca=c(139,249,112)
co=c(136,244,120)
a=rbind(ca,co)
MAX3(a,"asy",1)
##############################
I get:
The MAX3 test using the asy method
data: a
statistic = 0.5993, p-value = 0.7933
How can one save the result 0.7933 into a file?
say:
foo <- 0.7933
write.table(foo, file ="/home/foo.txt", sep = " ",
row.names=FALSE,col.names=TRUE, quote=FALSE, qmethod = "double")
However, instead of typing the value above, I would like to replace it by
the macro (scalar, local) that has the accurate p-value.
thanks in advance for your help.
Tiago
Justin Haynes
2012-Jan-23 17:42 UTC
[R] How can I access information stored after I run a command in R?
?str tells you about the object. str(MAX3(a,'asy',1)) from that you can see the names of the various parts including p.value. foo <- MAX3(a,'asy',1)$p.value On Mon, Jan 23, 2012 at 9:32 AM, Tiago V. Pereira <tiago.pereira@mbe.bio.br>wrote:> Dear all, > > Supposed I run the following command: > > ############################### > #install.packages("Rassoc", dependencies=TRUE) > library("Rassoc") > ca=c(139,249,112) > > co=c(136,244,120) > > a=rbind(ca,co) > > MAX3(a,"asy",1) > ############################## > > I get: > > The MAX3 test using the asy method > > data: a > statistic = 0.5993, p-value = 0.7933 > > > How can one save the result 0.7933 into a file? > > say: > > foo <- 0.7933 > > write.table(foo, file ="/home/foo.txt", sep = " ", > row.names=FALSE,col.names=TRUE, quote=FALSE, qmethod = "double") > > > However, instead of typing the value above, I would like to replace it by > the macro (scalar, local) that has the accurate p-value. > > thanks in advance for your help. > > Tiago > > ______________________________________________ > 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]]
Tiago V. Pereira
2012-Jan-23 18:25 UTC
[R] How can I access information stored after I run a command in R?
I would like to thank Justin and Matthias for their very helpful on my
query (see it below).
All the best,
Tiago
Dear all,
Supposed I run the following command:
###############################
#install.packages("Rassoc", dependencies=TRUE)
library("Rassoc")
ca=c(139,249,112)
co=c(136,244,120)
a=rbind(ca,co)
MAX3(a,"asy",1)
##############################
I get:
The MAX3 test using the asy method
data: a
statistic = 0.5993, p-value = 0.7933
How can one save the result 0.7933 into a file?
say:
foo <- 0.7933
write.table(foo, file ="/home/foo.txt", sep = " ",
row.names=FALSE,col.names=TRUE, quote=FALSE, qmethod = "double")
However, instead of typing the value above, I would like to replace it by
the macro (scalar, local) that has the accurate p-value.
thanks in advance for your help.
Tiago