[R] How to extract row values?
John Kane
jrkrideau at yahoo.ca
Thu Aug 20 20:24:04 CEST 2009
--- On Thu, 8/20/09, Peter Ehlers <ehlers at ucalgary.ca> wrote:
> From: Peter Ehlers <ehlers at ucalgary.ca>
> Subject: Re: [R] How to extract row values?
> To: "John Kane" <jrkrideau at yahoo.ca>
> Cc: r-help at r-project.org, "Henrik Kallberg" <Henrik.Kallberg at ki.se>
> Received: Thursday, August 20, 2009, 12:08 PM
>
> John Kane wrote:
> > What you have is a one-dimensional vector.
> Is that true?
Well for some values of one-dimentional. :) But basically I think so for Henrik's use.
>
> >
> > I think that you are up against an R default.
> You are going to get some names no matter what you do.
> You can always change them using the names() command,
> e.g. names(xx) <- c("a","b", "c") to replace the v1
> v2 v3
> You could try
> unname(unlist(dat[n, ]))
Arrgh, totally missed that one. Still, desperately rationalizing.,the names attribute is there, it's just set to NULL :)
>
> Peter Ehlers
>
> >
> > --- On Thu, 8/20/09, Henrik Kallberg <Henrik.Kallberg at ki.se>
> wrote:
> >
> >> From: Henrik Kallberg <Henrik.Kallberg at ki.se>
> >> Subject: [R] How to extract row values?
> >> To: r-help at r-project.org
> >> Received: Thursday, August 20, 2009, 7:55 AM
> >> Dear All!
> >> I'm trying to extract one specific row from a data
> frame
> >> without columnnames being included. I only want a
> >> 1-dimensional vector that consists of the specific
> data on
> >> this row. Here's an example:
> >> existing data:
> >> column names: v1v2v3
> >> Row 1 ab
> cd ef
> >> Row 2 gh
> ij kl
> >> Row 3 mn
> op qr
> >> This is what I want to extract:
> >> ab cd ef I do not want: v1v2v3
> >>
> ab cd ef
> >> Thank you in advance
> >> Henrik
> >>
> >> -----Inline Attachment Follows-----
> >>
> >> ______________________________________________
> >> 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.
> >>
> >
> >
> >
> __________________________________________________________________
> > Looking for the perfect gift? Give the gift of Flickr!
>
> > http://www.flickr.com/gift/
> >
> > ______________________________________________
> > 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.
> >
> >
>
__________________________________________________________________
The new Internet Explorer® 8 - Faster, safer, easier. Optimized for Yahoo! Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/
More information about the R-help
mailing list