Re: [R] Accessing values of a matrix

2010-02-22 Thread statquant
OKKK Thanks a lot for letting me know the subset function Cheers -- View this message in context: http://n4.nabble.com/Accessing-values-of-a-matrix-tp1561932p1564724.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.or

Re: [R] Accessing values of a matrix

2010-02-22 Thread David Winsemius
On Feb 22, 2010, at 8:45 AM, statquant wrote: Hello Sarah, thanks for answering For example if I have the following example test <- as.data.frame(matrix(c(1,2,3,4, 11,12,13,14, "a","b","b","c"), nrow = 3, ncol=3,dimnames = list(c("r1","r2","r3","r4"),NULL)) This is a malformed example. S

Re: [R] Accessing values of a matrix

2010-02-22 Thread statquant
Hello Sarah, thanks for answering For example if I have the following example test <- as.data.frame(matrix(c(1,2,3,4, 11,12,13,14, "a","b","b","c"), nrow = 3, ncol=3,dimnames = list(c("r1","r2","r3","r4"),NULL)) V1 V2 V3 r1 1 11 a r2 2 12 b r3 3 13 b r4 4 14 c it is easy to select

Re: [R] Accessing values of a matrix

2010-02-19 Thread Sarah Goslee
Hi Colin, You'll get a better answer if you provide an actual example, including what you tried that didn't work. It looks to me like you want to subset a data frame based on column names, though I'm not sure what A(i, J) is supposed to be. if so, then this is one approach: > A <- data.frame(A =

[R] Accessing values of a matrix

2010-02-19 Thread statquant
hello all, thank you for taking the time I have a matrix A that have column names (let say n columns), I want to reduce the matrix to have just a few of those column (p colums, this is trivial), but for the lines I want only the lines such that A(i,J) is part of a list (J is fixed and known) I a