#' fdf_to_plotdf_f
#'
#' clean fdf to plot_df
#' Dependencies: library1(c("plyr", "dplyr", "function0"))
#' return data frame
#' @importFrom magrittr %>%
#' @param fdf fdf
#' @keywords clean fdf to plot df
#' @export
#' @examples
#' fdf_to_plotdf_f(fdf)
fdf_to_plotdf_f <- function(fdf, mod = F){
if(mod){
pdf0 <- fdf %>% dplyr::group_by(code.) %>% dplyr::mutate(firstclose = 1)
}else{
pdf0 <- fdf %>% dplyr::group_by(code.) %>% dplyr::mutate(firstclose = last.[1])
}
plotdf1 <- pdf0 %>% dplyr::mutate(openmod = open/last.*lastmod*firstclose,
highmod = high/last.*lastmod*firstclose,
lowmod = low/last.*lastmod*firstclose,
lastmod = lastmod*firstclose,
vwapmod = vwap/last.*lastmod*firstclose,
qpe = m.cap./as.numeric(l4q.net.profit)
)
plotdf2 <- plotdf1 %>% dplyr::select(code = code., stock = stock., date = date,
open = openmod,
high = highmod,
low = lowmod,
close = lastmod,
vol = vol.)
plot_df <- as.data.frame(plotdf2)
return(plot_df)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.