# [R] correlation, import of large tables, test for point-biserial c.c.?

Spencer Graves spencer.graves at pdf.com
Fri Jul 11 16:39:59 CEST 2003

```Did you look at "?cor"?

The documentation observes that cor accepts an optional second argument.
The following works:
> df1 <- data.frame(a=1:8, b=rep(c(-1, 1), 4),
+  c=rep(c(-1, 1), each=4))
> cor(df1[,1], df1[, -1])
b         c
[1,] 0.2182179 0.8728716
>
hope this helps.  spencer graves

ArneSaatkamp at gmx.de wrote:
> Dear R help community,
>
> I want to calculate correlations between environment parameters and species
> abundance data. When I use the cor() for my table (121 columns 91 rows) R
> generates a dataset with the correlations between all columns;
>
> 1) How can I limit the calculations to the correlations of only the first
> column with every other ? (Or:) How can I extract the line/row in question from
> the cor() dataset produced by R ?
>
> 2) I assume that with one continuous factor and the other binary (0/1),
> cor() gives the point-biserial correlation coefficient, but how can I find the
> method used by R ?
>
> 3) I was not able to import (from "Excel") the whole 121x67 table, for
> instance I divided it into pieces. Is there a simple solution to import the whole
> file ?
>
> 4) In the end I want to test the correlation coefficients. Where do I find
> an appropriated test for the point biserial correlation ? Can R calculate the
> coefficient and test it for all data in one step ?
>
> I just started working & learning with R, but even after reading the R-help
> and Introduction to R, I still have big difficulties, so
>
> Arne Saatkamp
>
> Arne Saatkamp
> Inst. f. Biol. II - Abt. f. Geobotanik
> Schänzlestr. 1
> 79104 Freiburg
> Germany
>

```