Using the tidyquant package in R I downloaded stock data from 2 firms. I want to add a column with the lowest (adjusted) stock prices for each firm. The code below only adds the lowest for both firms together. What am I doing wrong? Is this the correct (dplyr)-way, or not?
data <- c("AAPL", "MMM") %>% tq_get(get = "stock.prices",
from = 1980-01-01,
to = 2018-05-05)
data %>% group_by(symbol) %>% mutate(lowest=min(adjusted, na.rm=TRUE))