Hello,
Try
?subset
subset(dtfr, Col1 == "xxx")
?"["
dtfr[Col1 == "xxy", ]
Hope this helps,
Rui Barradas
Em 24-05-2012 11:00, Manish Gupta <mandecent.gupta at gmail.com>
escreveu:> Date: Thu, 24 May 2012 01:09:58 -0700 (PDT)
> From: Manish Gupta<mandecent.gupta at gmail.com>
> To:r-help at r-project.org
> Subject: [R] How to retrieve value form dataframe by Key?
> Message-ID:<1337846998835-4631173.post at n4.nabble.com>
> Content-Type: text/plain; charset=us-ascii
>
> Hi,
>
> I have one datagrame
>
> Col1 Col2 Col3
> Col3
> xxx er This is third record of 1st line.
> This is 4th record of first line.
> xxy er This is third record of 1st line.
> This is 4th record of second line
> xyx er This is third record of 1st line.
> This is 4th record of third line
>
> I want to get records corresponding to key (here Col1). How can i implement
> it?
>
> e.g.
> if i key in xxx i should get
> xxx er This is third record of 1st line.
> This is 4th record of first line.
>
> if i key in xxy i should get
> xxy er This is third record of 1st line.
> This is 4th record of second line
>
> Regards
>
>
> --
> View this message in
context:http://r.789695.n4.nabble.com/How-to-retrieve-value-form-dataframe-by-Key-tp4631173.html
> Sent from the R help mailing list archive at Nabble.com.