shixin <jasonshi510 <at> hotmail.com> writes: > > I try to export the outputs of rcorr into excel. but I got error message,"cannot coerce class "rcorr" into a > data.frame". Actually i just need export part of results of this analysis,e.g. p-values or stat-values. library(Hmisc) x <- c(-2, -1, 0, 1, 2) y <- c(4, 1, 0, 1, 4) z <- c(1, 2, 3, 4, NA) v <- c(1, 2, 3, 4, 5) rc = rcorr(cbind(x,y,z,v))
str(rc) gives List of 3 $ r: num [1:4, 1:4] 1 0 1 1 0 ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr [1:4] "x" "y" "z" "v" .. ..$ : chr [1:4] "x" "y" "z" "v" $ n: int [1:4, 1:4] 5 5 4 5 5 5 4 5 4 4 ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr [1:4] "x" "y" "z" "v" .. ..$ : chr [1:4] "x" "y" "z" "v" $ P: num [1:4, 1:4] NA 1 0 0 1 ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr [1:4] "x" "y" "z" "v" .. ..$ : chr [1:4] "x" "y" "z" "v" - attr(*, "class")= chr "rcorr" So you could write.table or whatever on rc$r rc$n rc$P Dieter ______________________________________________ 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.