[R] t-scores and correlation

William Revelle lists at revelle.net
Sat Jul 11 23:26:06 CEST 2009


Adrian and Jorge,
   Try either rcorr in the Hmisc package or corr.test in the psych package.

They both will give you a matrix of correlations as well as the p 
values of the correlations.

Bill

At 4:38 PM -0400 7/10/09, Jorge Ivan Velez wrote:
>Hi Adrian,
>Using cor.test you need either two variables or a formula as stated in
>?cor.test  :-)
>
>Take a look at
>
>http://www.nabble.com/Re:-applying-cor.test-to-a-(m,-n)-matrix---SUMMARY-to17150239.html#a17150239
>
>for different alternatives to do what you asked for.
>
>HTH,
>
>Jorge
>
>
>On Fri, Jul 10, 2009 at 4:25 PM, Adrian Johnson
><oriolebaltimore at gmail.com>wrote:
>
>>  Thank you Jorge.
>>
>>  I tried it, i have the following error. honestly I dont understand the
>>  error. could you help please.
>>  thank you.
>>
>>  > cor.test(t(longley),method='pearson')
>>  Error in cor.test.default(t(longley), method = "pearson") :
>>   element 1 is empty;
>>    the part of the args list of 'length' being evaluated was:
>>    (y)
>>
>>
>>
>>
>>
>>  On Fri, Jul 10, 2009 at 4:22 PM, Jorge Ivan
>>  Velez<jorgeivanvelez at gmail.com> wrote:
>>  > Dear Adrian,
>>  > See ?cor.test.
>>  > HTH,
>>  >
>>  > Jorge
>>  >
>>  >
>>  > On Fri, Jul 10, 2009 at 4:13 PM, Adrian Johnson <
>>  oriolebaltimore at gmail.com>
>>  > wrote:
>>  >>
>>  >> Hi I have a matrix with samples on columns and variables and their
>>  >> values on rows.
>>  >> I want to calculate correlation (pearson) between a variable and
>>  >> others in rows and obtain t-scores for the variables.
>>  >> how can i do it.
>>  >> thank you.
>>  >> Ad
>>  >>
>>  >> ______________________________________________
>>  >> R-help at 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.
>>  >
>>  >
>>
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at 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.


-- 
William Revelle		http://personality-project.org/revelle.html
Professor			http://personality-project.org/personality.html
Department of Psychology             http://www.wcas.northwestern.edu/psych/
Northwestern University	http://www.northwestern.edu/
Attend  ISSID/ARP:2009               http://issid.org/issid.2009/




More information about the R-help mailing list