On Thu, Mar 7, 2013 at 11:02 AM, eliza botto <eliza_bo...@hotmail.com> wrote: > > Dear XpeRts, > I prepared a no qoute Character string by the following command > > s<-noquote(paste (b1, collapse=",")) > > where, b1 is the vector of 24 intergers. > >> dput(b1) > > c(1L, 2L, 6L, 7L, 12L, 16L, 17L, 20L, 21L, 23L, 25L, 34L, 46L, 48L, 58L, 64L, > 65L, 68L, 82L, 97L, 98L, 101L, 113L, 115L) > >> dput(s) > > structure("1,2,6,7,12,16,17,20,21,23,25,34,46,48,58,64,65,68,82,97,98,101,113,115", > class = "noquote") > > I want to use "s" in the following command > > matb1<-res[,c(s))] > > The objective is to call those columns of matrix "res", whose numbers have > been defined in "s". > But when i plug "s" into "matb1" i get the following error > > Error: no 'dimnames' attribute for array > > How can i get rid of it?? > thanks in advance
I may be way off-base here, but can't you just use res[, b1]? As to the explanation as to why you get that error, let's just say it's because c(s) doesn't result in a numerical vector and leave it at that. Cheers, MW > > Eliza > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. ______________________________________________ R-help@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.