# [R] caculate correlation

Jim Lemon drjimlemon at gmail.com
Wed Feb 1 03:00:34 CET 2017

```Hi Elham,
It looks to me as though you are looking for matches in the name field
and then asking for all columns except the first (-1). If you only
have two columns in "coding.rpkm", and "name" is the first column, you
will get whatever is in the second column that has a match in the
"name" column. I suspect that whatever you are doing to whatever is in
the data frames is just returning names, and without knowing what the
data frames look like, nobody can tell you what is going wrong.

Jim

On Tue, Jan 31, 2017 at 10:31 PM, Elham - <ed_isfahani at yahoo.com> wrote:
> thank you for replay dear Jim,
> actually I`m new in R and I asked the person that teach correlation to
> me,but I have problem in it.
> please guide me, I can not understand why notwithstanding I transpose data,
> I do not have number in coding.rpkm[grep("23.C",coding.rpkm\$name),-1]  and
> there is gene name instead of number
>
>
> On Tuesday, January 31, 2017 12:20 PM, Jim Lemon <drjimlemon at gmail.com>
> wrote:
>
>
> Hi Elham,
>
> On Tue, Jan 31, 2017 at 7:28 PM, Elham - <ed_isfahani at yahoo.com> wrote:
>> Hi Dear Jim,
>>
>> I did it, both return a vector of name of the genes with different
>> length,as
>> I said before I have list of coding and noncoding so the length are not
>> same.
>>
>> where is number?!
>>
> Not in the values you are extracting from the data frame. As you are
> aware, you can only perform the "cor" operation on numbers. As the
> value returned refers to the correlation of _pairs_ of values, the
> vectors of numbers should be the same length and there should be some
> meaningful relationship between those pairs. Are you just trying to
> correlate any old numbers because they are numbers?
>
>> and at the end of print there is this error :
>>
>> <0 rows> (or 0-length row.names)
>>
> This is probably not an error, just R telling you that something that
> was requested didn't have anything in it. Maybe one day we will find
> out what is in:
>
> coding.rpkm
> ncoding.rpkm
>