Re: rcorr error in R stat

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: rcorr error in R stat

Rui Barradas
Hello,

Please keep this on the list, always cc r-help.
One of the files in your attachment is empty:

y <- read.csv(file.choose("GT.csv"))
Error in read.table(file = file, header = header, sep = sep, quote = quote,  :
  no lines available in input

Rui Barradas
 

Citando Chaitanya Ganne <[hidden email]>:

> Thank you so much for your input.
>
> I am relatively new to R and I don't understand this "read.csv  
> returns data.frames". Sorry.
>
> This however did not work. "unlist(x) and unlist(y)". I got a series  
> of 43 warnings:
>
> Warning messages:
> 1: In doTryCatch(return(expr), name, parentenv, handler) :
>   "method" is not a graphical parameter
> 2: In doTryCatch(return(expr), name, parentenv, handler) :
>   "method" is not a graphical parameter
> .
> .
> .
> .
> .
>
>   "method" is not a graphical parameter
> 42: In doTryCatch(return(expr), name, parentenv, handler) :
>   "method" is not a graphical parameter
> 43: In cbind(x, y) :
>   number of rows of result is not a multiple of vector length (arg 2)
>  
> Would it help if I send the two csv files to you? I'd really  
> appreciate your help.
>
> Thanking you
>  
>
> -------------------------
> FROM: [hidden email] <[hidden email]>
> SENT: Wednesday, September 20, 2017 5:21:04 PM
> TO: Chaitanya Ganne
> SUBJECT: Re: rcorr error in R stat
>
> Hello,
>
> Maybe I'm completely off, but read.csv returns data.frames, which  
> are lists with a dim attribute.
> Instead of as.vector try unlist(x) and unlist(y).
>
> Note that if 'df' is a data.frame, class(as.vector(df)) returns "data.frame".
>
> Hope this helps,
>
> Rui Barradas
>  
>
> Citando Chaitanya Ganne <[hidden email]>:
>
>> Good afternoon, 
>>
>> I have two variables x and y. I am trying to run a correlation  
>> between them as vectors. 
>> x <- read.csv(file.choose(NPA.csv))
>> y <- read.csv(file.choose(GT.csv))
>> res <- cor(as.vector(x), as.vector(y))
>> round(res, 2)
>> install.packages("Hmisc")
>> library(Hmisc)
>> res2 <- rcorr(as.vector(x), as.vector(y))
>> res2 <- rcorr(as.vector(x), as.vector(y))
>> Error in storage.mode(x) <- "double" : 
>>  (list) object cannot be coerced to type 'double'
>>  
>> ---------------------------------------------------
>>
>> In fact I find this is something to do with the way the matrices  
>> are being considered for rcorr to be different from the way the  
>> matrices are being considered for 'cor'. The cor function gave me  
>> this output as mentioned below. However I am using the rcorr  
>> function to build the correlplots later on.
>>            
>>
>>
>>   BC_11L_parstriangularis_1 BC_12L_rostralmiddlefrontal_2  
>> BC_20L_fusiform_4 BC_21L_inferiortemporal_3  
>> BC_23L_middletemporal_1 vw_12L_rostralmiddlefrontal_2  
>> vw_19L_inferiorparietal_1
>>   CVLT_T4 -0.23 0.13 -0.01 -0.24 -0.14 0.02 0.06
>>   CVLT_T5 -0.28 0.12 0.04 -0.25 -0.19 0.15 0.11
>>   CVLT_Total -0.25 0.07 0.13 -0.25 -0.22 0.05 -0.05
>>   CVLT_LDF -0.16 0.04 0.16 -0.23 -0.32 0.16 0.01
>>   CVLT_RoF -0.12 0.02 0.06 -0.04 -0.14 0.16 -0.06
>>   CVLT_TDR -0.11 0.1 0.13 -0.24 -0.25 0.25 -0.06
>>   LM_I -0.46 -0.19 -0.11 -0.06 -0.24 -0.01 0.1
>>   LM_II -0.35 0.06 0.05 -0.11 -0.31 0.22 0.05
>>   p_REC -0.12 -0.27 0.36 -0.19 -0.09 -0.17 -0.21
>>   TF -0.01 -0.01 -0.21 -0.2 -0.27 -0.07 0.06
>>
>>  
>> Please help.
>>
>> /DR. GANNE CHAITANYA MD, PHD/
>>
>> /PDF //NEUROLOGY/
>>
>> /TJU, //PHILADELPHIA, 19107, PA/
>>
>>
>>   The information contained in this transmission contains  
>> privileged and confidential information. It is intended only for  
>> the use of the person named above. If you are not the intended  
>> recipient, you are hereby notified that any review, dissemination,  
>> distribution or duplication of this communication is strictly  
>> prohibited. If you are not the intended recipient, please contact  
>> the sender by reply email and destroy all copies of the original  
>> message.
>>
>> _CAUTION_: Intended recipients should NOT use email communication  
>> for emergent or urgent health care matters.
>
>  

 

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: rcorr error in R stat

Rui Barradas
Hello,

Also, the other file, NPA.csv, is not in tabular form. Can you please  
reformat it?

Rui Barradas


Citando [hidden email]:

> Hello,
>
> Please keep this on the list, always cc r-help.
> One of the files in your attachment is empty:
>
> y <- read.csv(file.choose("GT.csv"))
> Error in read.table(file = file, header = header, sep = sep, quote =  
> quote,  :
>   no lines available in input
>
> Rui Barradas
>  
>
> Citando Chaitanya Ganne <[hidden email]>:
>
>> Thank you so much for your input.
>>
>> I am relatively new to R and I don't understand this "read.csv
>> returns data.frames". Sorry.
>>
>> This however did not work. "unlist(x) and unlist(y)". I got a series
>> of 43 warnings:
>>
>> Warning messages:
>> 1: In doTryCatch(return(expr), name, parentenv, handler) :
>>   "method" is not a graphical parameter
>> 2: In doTryCatch(return(expr), name, parentenv, handler) :
>>   "method" is not a graphical parameter
>> .
>> .
>> .
>> .
>> .
>>
>>   "method" is not a graphical parameter
>> 42: In doTryCatch(return(expr), name, parentenv, handler) :
>>   "method" is not a graphical parameter
>> 43: In cbind(x, y) :
>>   number of rows of result is not a multiple of vector length (arg 2)
>>  
>> Would it help if I send the two csv files to you? I'd really
>> appreciate your help.
>>
>> Thanking you
>>  
>>
>> -------------------------
>> FROM: [hidden email] <[hidden email]>
>> SENT: Wednesday, September 20, 2017 5:21:04 PM
>> TO: Chaitanya Ganne
>> SUBJECT: Re: rcorr error in R stat
>>
>> Hello,
>>
>> Maybe I'm completely off, but read.csv returns data.frames, which
>> are lists with a dim attribute.
>> Instead of as.vector try unlist(x) and unlist(y).
>>
>> Note that if 'df' is a data.frame, class(as.vector(df)) returns  
>> "data.frame".
>>
>> Hope this helps,
>>
>> Rui Barradas
>>  
>>
>> Citando Chaitanya Ganne <[hidden email]>:
>>
>>> Good afternoon, 
>>>
>>> I have two variables x and y. I am trying to run a correlation
>>> between them as vectors. 
>>> x <- read.csv(file.choose(NPA.csv))
>>> y <- read.csv(file.choose(GT.csv))
>>> res <- cor(as.vector(x), as.vector(y))
>>> round(res, 2)
>>> install.packages("Hmisc")
>>> library(Hmisc)
>>> res2 <- rcorr(as.vector(x), as.vector(y))
>>> res2 <- rcorr(as.vector(x), as.vector(y))
>>> Error in storage.mode(x) <- "double" : 
>>>  (list) object cannot be coerced to type 'double'
>>>  
>>> ---------------------------------------------------
>>>
>>> In fact I find this is something to do with the way the matrices
>>> are being considered for rcorr to be different from the way the
>>> matrices are being considered for 'cor'. The cor function gave me
>>> this output as mentioned below. However I am using the rcorr
>>> function to build the correlplots later on.
>>>            
>>>
>>>
>>>   BC_11L_parstriangularis_1 BC_12L_rostralmiddlefrontal_2
>>> BC_20L_fusiform_4 BC_21L_inferiortemporal_3
>>> BC_23L_middletemporal_1 vw_12L_rostralmiddlefrontal_2
>>> vw_19L_inferiorparietal_1
>>>   CVLT_T4 -0.23 0.13 -0.01 -0.24 -0.14 0.02 0.06
>>>   CVLT_T5 -0.28 0.12 0.04 -0.25 -0.19 0.15 0.11
>>>   CVLT_Total -0.25 0.07 0.13 -0.25 -0.22 0.05 -0.05
>>>   CVLT_LDF -0.16 0.04 0.16 -0.23 -0.32 0.16 0.01
>>>   CVLT_RoF -0.12 0.02 0.06 -0.04 -0.14 0.16 -0.06
>>>   CVLT_TDR -0.11 0.1 0.13 -0.24 -0.25 0.25 -0.06
>>>   LM_I -0.46 -0.19 -0.11 -0.06 -0.24 -0.01 0.1
>>>   LM_II -0.35 0.06 0.05 -0.11 -0.31 0.22 0.05
>>>   p_REC -0.12 -0.27 0.36 -0.19 -0.09 -0.17 -0.21
>>>   TF -0.01 -0.01 -0.21 -0.2 -0.27 -0.07 0.06
>>>
>>>  
>>> Please help.
>>>
>>> /DR. GANNE CHAITANYA MD, PHD/
>>>
>>> /PDF //NEUROLOGY/
>>>
>>> /TJU, //PHILADELPHIA, 19107, PA/
>>>
>>>
>>>   The information contained in this transmission contains
>>> privileged and confidential information. It is intended only for
>>> the use of the person named above. If you are not the intended
>>> recipient, you are hereby notified that any review, dissemination,
>>> distribution or duplication of this communication is strictly
>>> prohibited. If you are not the intended recipient, please contact
>>> the sender by reply email and destroy all copies of the original
>>> message.
>>>
>>> _CAUTION_: Intended recipients should NOT use email communication
>>> for emergent or urgent health care matters.
>>
>>  
>
>  
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: rcorr error in R stat

Chaitanya Ganne
My apologies for the late reply. I had scans after I last messaged you yesterday.


Please find attached the ms-dos CSV file which I prepared using microsoft excel. there should be GT1.csv and NPA1.csv.


Thanking you

________________________________
From: [hidden email] <[hidden email]>
Sent: Thursday, September 21, 2017 1:21:22 PM
To: Chaitanya Ganne; r-help
Subject: Re: [R] rcorr error in R stat

Hello,

Also, the other file, NPA.csv, is not in tabular form. Can you please
reformat it?

Rui Barradas


Citando [hidden email]:

> Hello,
>
> Please keep this on the list, always cc r-help.
> One of the files in your attachment is empty:
>
> y <- read.csv(file.choose("GT.csv"))
> Error in read.table(file = file, header = header, sep = sep, quote =
> quote,  :
>   no lines available in input
>
> Rui Barradas
>
>
> Citando Chaitanya Ganne <[hidden email]>:
>
>> Thank you so much for your input.
>>
>> I am relatively new to R and I don't understand this "read.csv
>> returns data.frames". Sorry.
>>
>> This however did not work. "unlist(x) and unlist(y)". I got a series
>> of 43 warnings:
>>
>> Warning messages:
>> 1: In doTryCatch(return(expr), name, parentenv, handler) :
>>   "method" is not a graphical parameter
>> 2: In doTryCatch(return(expr), name, parentenv, handler) :
>>   "method" is not a graphical parameter
>> .
>> .
>> .
>> .
>> .
>>
>>   "method" is not a graphical parameter
>> 42: In doTryCatch(return(expr), name, parentenv, handler) :
>>   "method" is not a graphical parameter
>> 43: In cbind(x, y) :
>>   number of rows of result is not a multiple of vector length (arg 2)
>>
>> Would it help if I send the two csv files to you? I'd really
>> appreciate your help.
>>
>> Thanking you
>>
>>
>> -------------------------
>> FROM: [hidden email] <[hidden email]>
>> SENT: Wednesday, September 20, 2017 5:21:04 PM
>> TO: Chaitanya Ganne
>> SUBJECT: Re: rcorr error in R stat
>>
>> Hello,
>>
>> Maybe I'm completely off, but read.csv returns data.frames, which
>> are lists with a dim attribute.
>> Instead of as.vector try unlist(x) and unlist(y).
>>
>> Note that if 'df' is a data.frame, class(as.vector(df)) returns
>> "data.frame".
>>
>> Hope this helps,
>>
>> Rui Barradas
>>
>>
>> Citando Chaitanya Ganne <[hidden email]>:
>>
>>> Good afternoon,
>>>
>>> I have two variables x and y. I am trying to run a correlation
>>> between them as vectors.
>>> x <- read.csv(file.choose(NPA.csv))
>>> y <- read.csv(file.choose(GT.csv))
>>> res <- cor(as.vector(x), as.vector(y))
>>> round(res, 2)
>>> install.packages("Hmisc")
>>> library(Hmisc)
>>> res2 <- rcorr(as.vector(x), as.vector(y))
>>> res2 <- rcorr(as.vector(x), as.vector(y))
>>> Error in storage.mode(x) <- "double" :
>>>  (list) object cannot be coerced to type 'double'
>>>
>>> ---------------------------------------------------
>>>
>>> In fact I find this is something to do with the way the matrices
>>> are being considered for rcorr to be different from the way the
>>> matrices are being considered for 'cor'. The cor function gave me
>>> this output as mentioned below. However I am using the rcorr
>>> function to build the correlplots later on.
>>>
>>>
>>>
>>>   BC_11L_parstriangularis_1  BC_12L_rostralmiddlefrontal_2
>>>      BC_20L_fusiform_4        BC_21L_inferiortemporal_3
>>>      BC_23L_middletemporal_1  vw_12L_rostralmiddlefrontal_2
>>>      vw_19L_inferiorparietal_1
>>>   CVLT_T4    -0.23    0.13     -0.01    -0.24    -0.14    0.02     0.06
>>>   CVLT_T5    -0.28    0.12     0.04     -0.25    -0.19    0.15     0.11
>>>   CVLT_Total         -0.25    0.07     0.13     -0.25    -0.22    0.05     -0.05
>>>   CVLT_LDF   -0.16    0.04     0.16     -0.23    -0.32    0.16     0.01
>>>   CVLT_RoF   -0.12    0.02     0.06     -0.04    -0.14    0.16     -0.06
>>>   CVLT_TDR   -0.11    0.1      0.13     -0.24    -0.25    0.25     -0.06
>>>   LM_I       -0.46    -0.19    -0.11    -0.06    -0.24    -0.01    0.1
>>>   LM_II      -0.35    0.06     0.05     -0.11    -0.31    0.22     0.05
>>>   p_REC      -0.12    -0.27    0.36     -0.19    -0.09    -0.17    -0.21
>>>   TF         -0.01    -0.01    -0.21    -0.2     -0.27    -0.07    0.06
>>>
>>>
>>> Please help.
>>>
>>> /DR. GANNE CHAITANYA MD, PHD/
>>>
>>> /PDF //NEUROLOGY/
>>>
>>> /TJU, //PHILADELPHIA, 19107, PA/
>>>
>>>
>>>   The information contained in this transmission contains
>>> privileged and confidential information. It is intended only for
>>> the use of the person named above. If you are not the intended
>>> recipient, you are hereby notified that any review, dissemination,
>>> distribution or duplication of this communication is strictly
>>> prohibited. If you are not the intended recipient, please contact
>>> the sender by reply email and destroy all copies of the original
>>> message.
>>>
>>> _CAUTION_: Intended recipients should NOT use email communication
>>> for emergent or urgent health care matters.
>>
>>
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help&data=02%7C01%7CChaitanya.Ganne%40jefferson.edu%7C2294ae18fd7e4a3b9fcd08d501153840%7C55a89906c710436bbc444c590cb67c4a%7C0%7C0%7C636416113005878432&sdata=QZ6qfoYeF2NGwDcQ2ASnZQCAI0OnYDQ%2FhBBQzhN7fJQ%3D&reserved=0
> PLEASE do read the posting guide https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.R-project.org%2Fposting-guide.html&data=02%7C01%7CChaitanya.Ganne%40jefferson.edu%7C2294ae18fd7e4a3b9fcd08d501153840%7C55a89906c710436bbc444c590cb67c4a%7C0%7C0%7C636416113005878432&sdata=1fr2Lpgsa7T0Y%2BjD%2FO35d%2FezFGKMdzdO0WE4RTNG7Po%3D&reserved=0
> and provide commented, minimal, self-contained, reproducible code.




The information contained in this transmission contains privileged and confidential information. It is intended only for the use of the person named above. If you are not the intended recipient, you are hereby notified that any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.

CAUTION: Intended recipients should NOT use email communication for emergent or urgent health care matters.

______________________________________________
[hidden email] 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.