I'm trying to simplify this with a few statements. Not sure how to go about it (or if i can), but anyone that can get me close or as few steps as possible. I am using dplyr and lubridate. I have a database called OutofRange (sample);
OutOfRange %>% select(OutRange, TouchVPOC)
Source: local data frame [341 x 2]
OutRange TouchVPOC
(lgl) (lgl)
1 FALSE TRUE
2 FALSE FALSE
3 FALSE TRUE
4 FALSE FALSE
5 FALSE TRUE
OutOfRange %>% select(OutRange, TouchVPOC) %>% filter(OutRange == T) %>% tally
Source: local data frame [1 x 1]
n (int)
1 37
OutOfRange %>% select(OutRange, TouchVPOC) %>% filter(OutRange == T, TouchVPOC == T) %>% tally
Source: local data frame [1 x 1]
n (int)
1 15
15/37
[1] 0.4054054
So, if possible I'm looking for a final outcome of something like this, where CountofDataFrame is the count of all rows; where OutRange & TouchVPOC are the count of TRUE Values; and Pct = TouchVPOC/OutRange.
CountOfDataFrame OutRange TouchVPOC Pct
341 37 15 .40
I do realize, I may be asking alot.. and I'm new to this, any suggestions are welcome. Just looking for a basis or a start in the right direction.