Hello,

If I understand it well, the following should do it.


dd <- subset(f, sold == 1)
at <- with(dd, bid == purchase)
mean(at)  # wanted value

Hope this helps,

Rui Barradas

Em 09-08-2012 01:52, Daisy Englert Duursma escreveu:
Your question is very unclear.Can you provide a better question or at
least a column of outputs you expect and an example with the dataframe
you provided?

On Thu, Aug 9, 2012 at 8:29 AM, Abraham Mathew <abmathe...@gmail.com> wrote:
I have the following data and am trying to find the percentage of bid
values purchased for that price.

So let's say I have a bid of 5 and it's sold 2 times for $3 and $5. Since
the original bid was $5, the
percentage of times that that bid value results in a sold purchase AT that
specific bid level was
1/3 because of the three time where the bid was three, it ended up being
sold for $5 one time.

So I'm wonder how to generate that info in R. The percentage of a bid being
sold at the same purchase
price. Can anyone point me in the right direction.

f = data.frame(bid=c(3,5,5,8,3,5,4,2,3,5), purchase=c(6,3,4,5,5,5,6,2,3,7),
                sold=c(0,1,0,0,0,1,1,0,0,1))
f


Thanks.


--
*Abraham Mathew
Statistical Analyst
www.amathew.com
720-648-0108
@abmathewks*

         [[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.
______________________________________________
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.

______________________________________________
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.

Reply via email to