简体   繁体   中英

could not find function “hc_add_series_density” Highcharter R

I'm using Highcharter version 0.6.0 (R)

I need to build density plots and each plot needs to have multiple series. I looked up online and came across hc_add_series_density by Nuno Agostinho.

I tried using it in the code below but i get the error - "could not find function "hc_add_series_density""

library(highcharter)
library(magrittr)

set.seed(1) 
x <- rbeta(300, 0.2, 4) 
y <- rbeta(300, 0.5, 4) 

hcdensity(x, area = TRUE) %>% 
    hc_add_series_density(y, area = TRUE)

Is it not there in version 0.6.0 ? If not, how can I achieve density plots with multiple series ?

Thank You

There's no function hc_add_series_density , there's a method hc_add_series.density , but you usually wouldn't call it directly. Instead, you'd just call hc_add_series on a density object, and the appropriate method will be called, eg:

hcdensity(x, area = TRUE) %>% 
    hc_add_series(density(y), area = TRUE)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM