Hi, Using the example data from ?rcorr library(Hmisc) 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) rho <- rcorr(cbind(x,y,z,v)) #you could use ?capture.output capture.output(rho, file="file1.txt")
#or may be: sapply(rho,write.table,file="file2.csv",append=TRUE,sep=",") A.K. On Saturday, May 17, 2014 6:41 AM, smart hendsome <putra_autum...@yahoo.com> wrote: Hi Arun, Im new R users. I have one question how to save the output data from R. Below is the code. I want this output automatically save into file .csv. Hope you can help me. Thanks. > rho <- rcorr(as.matrix(dtxna), type="spearman") > rho V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V1 1.00 0.12 0.23 0.27 0.18 0.20 0.16 0.15 0.20 0.13 V2 0.12 1.00 0.11 0.15 0.20 0.14 0.26 0.24 0.16 0.23 V3 0.23 0.11 1.00 0.27 0.16 0.24 0.14 0.14 0.21 0.09 V4 0.27 0.15 0.27 1.00 0.20 0.30 0.19 0.16 0.24 0.14 V5 0.18 0.20 0.16 0.20 1.00 0.15 0.22 0.29 0.25 0.18 V6 0.20 0.14 0.24 0.30 0.15 1.00 0.24 0.13 0.18 0.12 V7 0.16 0.26 0.14 0.19 0.22 0.24 1.00 0.26 0.19 0.23 V8 0.15 0.24 0.14 0.16 0.29 0.13 0.26 1.00 0.21 0.23 V9 0.20 0.16 0.21 0.24 0.25 0.18 0.19 0.21 1.00 0.15 V10 0.13 0.23 0.09 0.14 0.18 0.12 0.23 0.23 0.15 1.00 n= 17073 P V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V1 0 0 0 0 0 0 0 0 0 V2 0 0 0 0 0 0 0 0 0 V3 0 0 0 0 0 0 0 0 0 V4 0 0 0 0 0 0 0 0 0 V5 0 0 0 0 0 0 0 0 0 V6 0 0 0 0 0 0 0 0 0 V7 0 0 0 0 0 0 0 0 0 V8 0 0 0 0 0 0 0 0 0 V9 0 0 0 0 0 0 0 0 0 V10 0 0 0 0 0 0 0 0 0 ______________________________________________ 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.