I want to use the highcharter package to chart some stocks. However, I receive some error messages, when I use install.packages and library. When I then try to use the highchart function, I get the following error message:

Error in highchart(type = "stock") : could not find function "highchart".

These are the errors while loading the package:

install.packages("highcharter")

trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.4/highcharter_0.7.0.tgz'

Content type 'application/x-gzip' length 2851784 bytes (2.7 MB)

==================================================

downloaded 2.7 MB

tar: Failed to set default locale

The downloaded binary packages are in /var/folders/g7/zltv5nrj1qj0hcmdyql94s3r0000gn/T//RtmpnlCQEr/downloaded_packages

library(highcharter)

Error: package or namespace load failed for 'highcharter' in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called 'data.table' In addition: Warning message: package 'highcharter' was built under R version 3.4.4

Also, when I manually "activate" the package, it will not work either. Tried to install the package and select it, also tried:

remove.packages(c("highcharter", "data.table"))
install.packages('highcharter', dependencies = TRUE)
install.packages('data.table', dependencies = TRUE)

Also tried

highcharter::highchart

This is the code I am running now:

# Charting stock prices
hchart(type = "stock") %>% 
  hc_title(text = "monthly log returns") %>% 
  hc_add_series(asset_returns_xts[, symbols[1]], name = symbols[1])

I have expected a chart as described with the highcharter documentation, instead the package and function is not found.

1 Answers

1
Bodo On

thank you for your help! I needed to uninstall R and RStudio from my machine and then it worked.

I am not entirely sure, why but it solved my issue, everything is running smoothly now.

Thank you again!

Best regards,

Bodo