Skip to content

Searching from Dataframe.

6 messages · David Winsemius, Rantony, Bert Gunter

#
Hi,
i have a dataframe containing some values.
for eg:-

MyDataFrame<-
Name   Age   Place
-------    ------    -----------
Aby          12        USA
Raj            25        UK
Romi        32        ENG
Amy         31        IND

My requirement what is, i have a search key word[it should search from all
the columns], that i need to find out from this dataframe. If search keyword
found , it should return that particular row and column number.

For eg:- My search keyword is "ENG".
After searching, it should return particular row & column number. Here it is
" MyDataFrame[3,3] "

Can anyone help me please ?

- Antony.



--
View this message in context: http://r.789695.n4.nabble.com/Searching-from-Dataframe-tp4642722.html
Sent from the R help mailing list archive at Nabble.com.
#
On Sep 11, 2012, at 12:11 AM, Rantony wrote:

            
row col
[1,]   3   3

You can certainly massage those values in any paste()y expression you choose.

--
David Winsemius, MD
Alameda, CA, USA
#
And how to get the vector from a list if the list item found inside ?
 for eg:- MyList<- c("US","UK","UAE")
Here i want to check a list item UAE which is in 3rd  row.
How i will get that row position ?

- Thanks in advance
Antony



--
View this message in context: http://r.789695.n4.nabble.com/Searching-from-Dataframe-tp4642722p4642744.html
Sent from the R help mailing list archive at Nabble.com.
#
Have you read "An Introduction to R" (ships with every copy of R)
where these sorts of questions are answered?

There are other R tutorials on the web also, if you look.

-- Bert
On Tue, Sep 11, 2012 at 3:59 AM, Rantony <antony.akkara at ge.com> wrote: