Hi, 2005/11/23, Ronnie Babigumira <[EMAIL PROTECTED]>: > Thomas many thanks, though str(myobject[ 5:9]) is not what I want, it > prompted me to try head(myobject [3:4]) and this gets me really close > to what I want, I get the first few observations of variables 3 and 4 > in my data. What I would like to do however is to do the same thing > but with the variable names explicitly (so instead of 3:4 I use > something like varname3 and varname4) > > Any ideas > > Again, many thanks to all on the list who have helped (I promise I am > frantically trying to read up everything I have been given and bring > myself upto speed so I will not be consuming bandwidth with a lot of > read the manual sort of questions) > > > > On 11/23/05, Thomas Schönhoff <[EMAIL PROTECTED]> wrote: > > Hello, > > > > 2005/11/23, Ronnie Babigumira <[EMAIL PROTECTED]>: > > > Many thanks to Peter Alspach, Jim Porzak and Murray Pung for the help. > > > Peter and Jim, head? and tail? was just what I needed to list a few > > > observations. Peter, thanks for pointing out str? to me. I totally > > > agree with you on its usefulness. > > > > > > Murray thanks for file > save workspace (and Peters save.image) > > > addresses the third of my concerns > > > > > > One last question related to head and tails, this works best if you > > > have a few variables (columns). Given more, how can I use the > > > information on the variable names given after str to list the first > > > few few observations for a set of variable. > > > > > > To make it clear. Say I load a dataset with n variables named v1 to > > > vn. I use str(mydata) and I get a list of variable names.. > > > > > > str(x) > > > v1 ...... > > > . ...... > > > . ...... > > > . ...... > > > . ...... > > > Vn ...... > > > > > > How do i list the first n observations of say v5 to v9 > > > > Not sure if this is what you are looking for: str(myobject[ 5:9])
myobservs <-str(myobject, myobject$v5[1:n],...,...,... myobject$9[1:n]) where n = number of observations to be selected. Hmm, not sure if this works for your object (data.frame, matrix, multi-dimensional array?). Would be much easier to know more about your object! regards Thomas ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
