Reading multiple matrices from the same file in R -
I know that you can read a matrix from a file using read.table
But I can read two matrix ( m
by n
) from one file in R and keep them in two different R variables. For example, for this example, there are two to three matrix 2 in this file:
6 3 2 5 5 4 4 3 6 3 3 4
< / Pre>
Here's my shot.
split (read.table ("data.txt"), gl (2, 3, label = c ("x1", "x2")))
It should be easy to normalize and wrap it in a function.
I hope it helps.
Comments
Post a Comment