holtman
Sent: Monday, October 21, 2013 5:21 PM
To: Mohammad Goodarzi
Cc: R mailing list
Subject: Re: [R] merging matrices
?list.files
?read.table
?rbind
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do
Dear all,
I have to load more than 1000 matrices from desktop which all of them have
the same size.
If I do it manually, it would be very hard, can you please guide me how to
load them and merge them together ?
for example I want to put them one after another
X1 X2 X3 etc
Many thanks,
Mohammad
Have you read An Introduction to R (ships with R) or any R web
tutorials to learn how R works? If not, don't you think you should
before posting here? Your question appears to be rather basic.
Cheers,
Bert
On Mon, Oct 21, 2013 at 3:18 AM, Mohammad Goodarzi
mohammad.goda...@gmail.com wrote:
Dear
?list.files
?read.table
?rbind
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.
On Mon, Oct 21, 2013 at 6:18 AM, Mohammad Goodarzi
mohammad.goda...@gmail.com wrote:
Dear all,
I have to load more than 1000
If you have over a thousand files on your desktop, you have bigger problems
than just how to load them into R.
Where do these files come from, and why do you want to merge them into a
single entity?
--
View this message in context:
To clarify, the two matrices might look like this:
A B C D E F
A 1 2 3 4 5 6
B 2 4 6 8 10 12
C 0 0 0 0 0 0
D 0 1 0 1 0 1
E 3 6 9 11 13 15
F 2 2 2 2 2 2
B D E
B 4 9 13
D 9 8 7
E 1 0 1
I would like this:
A B C D
The original post said the matrices are symmetric but it seems from
the examples that they are not symmetric but do each have the same row
and column names so we have assumed only this latter condition
instead.
If your matrices are called big and small then:
ix - rownames(big) %in%
Actually both the solutions I listed assume that every row in small is
in big. Although that was the case in the example you displayed, If
that is not the case in general then use intersect:
ix - intersect(rownames(big), rownames(small))
result - big
result[ix, ix] - big[ix, ix] + small[ix, ix]
I have two symmetric matrices, but of different dimensions. The entries are
identified by specific labels some of which are shared by both matrices. I
would like to sum the two matrices, but retain the union of the two. In
other words, I want the result to be the same size as the larger of the
On Mar 19, 2010, at 4:11 PM, duncandonutz wrote:
I have two symmetric matrices, but of different dimensions. The
entries are
identified by specific labels some of which are shared by both
matrices. I
would like to sum the two matrices, but retain the union of the
two. In
other words,
From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf
Of duncandonutz [dwads...@unm.edu]
Sent: March 19, 2010 1:11 PM
To: r-help@r-project.org
Subject: [R] Merging Matrices
I have two symmetric matrices, but of different
11 matches
Mail list logo