I am having the below code:
library(quantmod)
getSymbols("AAPL",from='2022-10-24',end='2022-10-28',header=FALSE)
Ticker<-"AAPL"
Start<-'2022-10-24'
End<-'2022-10-28'
getSymbols(Ticker,from=Start,end=End,header=FALSE)
price_max<-max(AAPL$AAPL.High)
price_min<-min(AAPL$AAPL.Low)
volume_max<-max(AAPL$AAPL.Volume)
volume_min<-min(AAPL$AAPL.Volume)
May I ask, if I wanna print the outputs like below, how should I go about it? Thank you so much.
The price range of "Ticker" from 'Start' to 'End' is 'price_min' to 'price_max'
The volume range is 'volume_min' to 'volume_max' shares.
CodePudding user response:
You can use the glue
package.
glue::glue("The price range of {Ticker} from {Start} to {End} is {price_min} to {price_max}")
#> The price range of AAPL from 2022-10-24 to 2022-10-28 is 144.130005 to 152.490005
glue::glue("The volume range is {volume_min} to {volume_max} shares.")
#> The volume range is 74732300 to 109180200 shares.