yep, that did the trick.

Thanks,
Sachin


On Fri, Mar 8, 2013 at 1:24 PM, Jeff Newmiller <jdnewmil@dcn.davis.ca.us>wrote:

> Something along the lines of
>
> top100 <- A[match(B,A[,1]),]
>
> Please provide R code with sample data and desired output. See
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
> ---------------------------------------------------------------------------
> Jeff Newmiller                        The     .....       .....  Go Live...
> DCN:<jdnewmil@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live
> Go...
>                                       Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
> ---------------------------------------------------------------------------
> Sent from my phone. Please excuse my brevity.
>
> Sachinthaka Abeywardana <sachin.abeywardana@gmail.com> wrote:
>
> >Hi all,
> >
> >I have two dataframes. The first (A) contains all the stock prices for
> >today including today. So the first column is the stock Symbol and the
> >second column is the stock price. The second (B) is the symbol list in
> >the
> >top 100 stocks.
> >
> >I want to pick out from dataframe A only the rows containing the
> >symbols
> >from B. i.e. something like:
> >
> >            prices <- A[A[,1]==B,2]
> >
> >is there any way to do this without using a for loop, I have to do this
> >365
> >times (i.e. for one year).
> >
> >Thanks,
> >Sachin
> >
> >       [[alternative HTML version deleted]]
> >
> >______________________________________________
> >R-help@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.
>
>

	[[alternative HTML version deleted]]

