Dear All,

Suppose I have 2 files:
# first one : testid.csv
A
B
C
D
E

> (id<- read.table ("testid.csv",col.name=c("id")))
  id
1  A
2  B
3  C
4  D
5  E

# second file is the result file I calculate from cor.text, which shows the
correlation coefficient.
> cor.value.t
          1          2           3           4          5
1 1.0000000  0.2156213  0.31000492  0.22282154  0.1822277
2 0.2156213  1.0000000 -0.31183893  0.42681488  0.3421535
3 0.3100049 -0.3118389  1.00000000 -0.02801885 -0.1307732
4 0.2228215  0.4268149 -0.02801885  1.00000000  0.1454049
5 0.1822277  0.3421535 -0.13077317  0.14540493  1.0000000

# I tried to merge these two files together.
# what I expected is like this:
A 1.0000000  0.2156213  0.31000492  0.22282154  0.1822277
B 0.2156213  1.0000000 -0.31183893  0.42681488  0.3421535
C 0.3100049 -0.3118389  1.00000000 -0.02801885 -0.1307732
D 0.2228215  0.4268149 -0.02801885  1.00000000  0.1454049
E 0.1822277  0.3421535 -0.13077317  0.14540493  1.0000000


# but after I used (output<-merge(id,cor.value.t)), which shows 25 lines
(below):
   id         1          2           3           4          5
1   A 1.0000000  0.2156213  0.31000492  0.22282154  0.1822277
2   B 1.0000000  0.2156213  0.31000492  0.22282154  0.1822277
3   C 1.0000000  0.2156213  0.31000492  0.22282154  0.1822277
4   D 1.0000000  0.2156213  0.31000492  0.22282154  0.1822277
5   E 1.0000000  0.2156213  0.31000492  0.22282154  0.1822277
6   A 0.2156213  1.0000000 -0.31183893  0.42681488  0.3421535
7   B 0.2156213  1.0000000 -0.31183893  0.42681488  0.3421535
8   C 0.2156213  1.0000000 -0.31183893  0.42681488  0.3421535
9   D 0.2156213  1.0000000 -0.31183893  0.42681488  0.3421535
10  E 0.2156213  1.0000000 -0.31183893  0.42681488  0.3421535
11  A 0.3100049 -0.3118389  1.00000000 -0.02801885 -0.1307732
12  B 0.3100049 -0.3118389  1.00000000 -0.02801885 -0.1307732
13  C 0.3100049 -0.3118389  1.00000000 -0.02801885 -0.1307732
14  D 0.3100049 -0.3118389  1.00000000 -0.02801885 -0.1307732
15  E 0.3100049 -0.3118389  1.00000000 -0.02801885 -0.1307732
16  A 0.2228215  0.4268149 -0.02801885  1.00000000  0.1454049
17  B 0.2228215  0.4268149 -0.02801885  1.00000000  0.1454049
18  C 0.2228215  0.4268149 -0.02801885  1.00000000  0.1454049
19  D 0.2228215  0.4268149 -0.02801885  1.00000000  0.1454049
20  E 0.2228215  0.4268149 -0.02801885  1.00000000  0.1454049
21  A 0.1822277  0.3421535 -0.13077317  0.14540493  1.0000000
22  B 0.1822277  0.3421535 -0.13077317  0.14540493  1.0000000
23  C 0.1822277  0.3421535 -0.13077317  0.14540493  1.0000000
24  D 0.1822277  0.3421535 -0.13077317  0.14540493  1.0000000
25  E 0.1822277  0.3421535 -0.13077317  0.14540493  1.0000000


Is anybody know why it outputs 5 times?

Thanks a lot!

Nina

        [[alternative HTML version deleted]]

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

Reply via email to