Dashboard problem with get sysmbols

I am trying to create a dashboard and my code is saying the below on the first chunk of the libraries any help on this:

 Error in getSymbols(c("MSFT", "HPQ", "INTC"), from = "2014-01-01", auto.assign = TRUE) : 
  could not find function "getSymbols"

The code is below:

title: "My First Dashboard"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: fill
    social: ["twitter", "facebook", "menu"]
---

```{r setup, include=FALSE}
library(flexdashboard)
library(knitr)
library(DT)
library(rpivotTable)
library(ggplot2)
library(plotly)
library(dplyr)
library(openintro)
library(highcharter)
library(ggvis)

library(dygraphs)
library(quantmod)

getSymbols(c("MSFT", "HPQ", "INTC"), from = "2014-01-01", auto.assign=TRUE)
```
```{r}
data <- read.csv("C:/Users/fungai/Google Drive/phiri/Sales.csv")
```

```{r}
mycolours<-c("blue", "#FFC125", "darkgreen","darkorange")
```

Interactive Data Visualisation
===============================================

Row
-----------------------------------------------

### Sales Analysis by Region


```{r}
valueBox(paste("Sales"),
         color = "warning")
```

### Average Sales Revenue

```{r}
valueBox(mean(data$Total.Revenue),
         icon = "fa-user")
```

### **Average Revenue**
```{r}
gauge(round(mean(data$Total.Revenue),
            digits = 2),
      min = 0,
      max = 5000000,
      gaugeSectors(success = c(2000000,5000000),
                   warning = c(500000,2000000),
                   danger = c(0,500000),
                   colors = c("green", "yellow","red")))
```

### Asia
```{r}
valueBox(sum(data$Region == "Asia"),
         icon = 'fa-building')
```

### Europe
```{r}
valueBox(sum(data$Region == "Europe"),
         icon = 'fa-building')
```

### North America
```{r}
valueBox(sum(data$Region == "North America"),
         icon = 'fa-building')
```

### Australia and Oceania
```{r}
valueBox(sum(data$Region == "Australia and Oceania"),
         icon = 'fa-building')
```


Row
----------------------------------------------------

### Sales Units by Category

```{r}
p1<- data %>%
  group_by(Item.Type) %>%
  summarise(Rev = sum(Total.Revenue)) %>%
  plot_ly(x = ~Item.Type,
          y = ~Rev,
          type = 'bar') %>%
  layout(xaxis = list(title = "Revenue by Region"),
         yaxis = list(title = 'Revenue'))
p1
```

### Revenue by Region

```{r}
p2<- data %>%
  group_by(Region) %>%
  summarise(Rev2 = sum(Total.Revenue)) %>%
  plot_ly(labels = ~Region,
          values = ~Rev2) %>%
  add_pie(hole = 0.4) %>%
  layout(xaxis = list(zeroline = F,
                      showline = F,
                      showticklabels = F,
                      showgrid = F),
         yaxis = list(zeroline = F,
                      showline = F,
                      showticklabels = F,
                      showgrid = F))
p2
```

Data Table
======================================================

```{r}
datatable(data,
          caption = "Sales Data",
          rownames = T,
          filter = "top",
          options = list(pagelength = 25))
```

Pivot Table
======================================================
```{r}
rpivotTable(data,
          aggregatorName = "Sum",
          rows = "Country",
          vals = c("Units.Sold", "Total.Revenue"),
          rendererName = "Heatmap")
```


Further Analysis - Units
======================================================

Columns
----------------------------------------------------
### Microsoft

```{r}
dygraph(MSFT[,2:4], group = "stocks") %>% 
  dySeries(c("MSFT.Low", "MSFT.Close", "MSFT.High"), label = "MSFT")
```

Do you get any error message while loading quantmod? It seems not to be working as expected

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.