[R] caculate correlation

Jim Lemon drjimlemon at gmail.com
Mon Jan 30 22:36:24 CET 2017


Hi Elham,
Without knowing much about what coding.rpkm and ncoding.rkpm look
like, it is difficult to say. Have you tried to subset these matrices
as you do in the "cor" function and see what is returned?

Jim

On Tue, Jan 31, 2017 at 6:40 AM, Elham - via R-help
<r-help at r-project.org> wrote:
> for calculating correlation between coding and noncoding,first I transposed data ,(rows become columns) so row is control&treatment and columns are gene names.(so I have 2 matrix with same row and different column),I use these function for calculating correlation but all of spearman correlation are NA,why?
>
>
> control.corr=cor(coding.rpkm[grep("23.C",coding.rpkm$name),-1],ncoding.rpkm[grep("23.C",ncoding.rpkm$name),-1],method= "spearman")
>
>
>
>
>
>
>
> tumor.corr=cor(coding.rpkm [grep("27.T", coding.rpkm $name),-1], ncoding.rpkm [grep("27.T", ncoding.rpkm $name),-1],method = "spearman")
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.



More information about the R-help mailing list