[R] extracting rows and columns from a big matrix
jim holtman
jholtman at gmail.com
Sun Jul 15 20:53:47 CEST 2012
For a start, you are missing a quote and a parenthese on the
statement; probably should be: (another quote was also missing)
n<-subset(m, select=c("X1", "X7", "X12","X15", "X22", "X26", "X31",
"X34", "X39", "X44", "X51", "X58"))
Not sure what you want with the rownames; an example would help and
post with 'dput'.
On Sun, Jul 15, 2012 at 2:47 PM, A J <anxusgo at hotmail.com> wrote:
>
> Hi there and thanks in advance.
>
> I have a large symmetrical matrix stored in a text file. After load in R I would like to extract the same number of columns and rows (symmetrical submatrix) using their labels.
>
> I have tried this code in order to extract columns, but R console gives me the "+" sign at the end of the code, pointing out incomplete command, so it is not working:
>
> m<-read.table("C:/backup/symmetrical.csv")
>
> n<-subset(m, select=c("X1", "X7", "X12", X15", "X22", "X26", "X31", "X34", "X39", "X44", "x51", "X58)
>
> Therefore, I have no tried with row names yet.
>
> Any suggestions? Sorry for the inconvenience. I have read some information about this but always have the same problem with "+" and I do not have any idea to follow.
>
> Best,
>
> AJ
>
>
>
>
> [[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.
--
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.
More information about the R-help
mailing list