[R] Getting rows from a dataframe
Rajarshi Guha
rajarshi at presidency.com
Thu Oct 9 18:11:36 CEST 2003
On Thu, 2003-10-09 at 12:02, Mark Lee wrote:
> Sorry if this is a silly question. I'm trying to extract all elements
> of a dataframe at a particular row. I can find no mention of this in
> any documentation and it may be naivety of dataframe on my part as I'm
> very green at this. Thankyou,
If d is your data.frame then
d[ 1, ]
will give all the columns coresponding to row 1 in a data.frame
> d <- read.table('data')
> class(d)
[1] "data.frame"
> x <- d[1,]
> class(x)
[1] "data.frame"
>
HTH
-------------------------------------------------------------------
Rajarshi Guha <rxg218 at psu.edu> <http://jijo.cjb.net>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
A red sign on the door of a physics professor:
'If this sign is blue, you're going too fast.'
More information about the R-help
mailing list