Description Usage Arguments Value Author(s) Examples
select whatExpression by byExpression from d where whereExpression order of evaluation from, where, by, what
1 |
d |
A dataframe |
where |
A list of constraints expressions evaluating to booleans |
by |
A list of groupby expression |
what |
A list of aggregate expressions |
A dataframe
JFP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | d <- data.frame(
date=seq(as.Date("2001-01-01"), as.Date("2001-12-01"), by="month"),
ticker=sample(c("1 HK", "2 HK"), 12, TRUE),
return=rnorm(12)
)
d %>% select(by=list(ticker=expression(ticker))) # defaut by to take last
d %>% select(by=list(ticker=expression(ticker)),
what=list(m=expression(mean(return)),s=expression(sd(return))))
d %>% update(by=list(ticker=expression(ticker)),
what=list(m=expression(mean(return)),s=expression(sd(return))))
d %>% select(where=list(expression(return>0)),
by=list(ticker=expression(ticker)),
what=list(m=expression(mean(return)),s=expression(sd(return))))
d %>% update(where=list(expression(return>0)),
by=list(ticker=expression(ticker)),
what=list(m=expression(mean(return)),s=expression(sd(return))))
d %>% update(where=list(expression(return>0)),
by=list(ticker=expression(ticker)),
what=list(m=expression(mean(return)),s=expression(sd(return))))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.