[R] rcorr error in R stat
ruipbarradas at sapo.pt
ruipbarradas at sapo.pt
Thu Sep 21 19:21:22 CEST 2017
Hello,
Also, the other file, NPA.csv, is not in tabular form. Can you please
reformat it?
Rui Barradas
Citando ruipbarradas at sapo.pt:
> 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 <Chaitanya.Ganne at jefferson.edu>:
>
>> 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: ruipbarradas at sapo.pt <ruipbarradas at sapo.pt>
>> 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 <Chaitanya.Ganne at jefferson.edu>:
>>
>>> 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]]
>
> ______________________________________________
> 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