Wondering if someone has some R capability to take a company name and output it's exchange and ticker symbol. For instance, could take a character vector input:
company <- c("Google", "General Motors Company", "singtei")
and return
stockinfo <- ("NASDAQ: GOOGL", "NYSE: GM", "SGX: Z74")
There may not be anything this straightforward (with a package like ggmap doing the heavy lifting), but as an example of a similar capability, this code returns geographic coordinates given city names:
# Cities needing geocodes
cities <- c("Phoenix", "Los Angeles", "Portland")
# Geocode function
library(ggmap)
coord <- geocode(cities)
# Geographic coordinates
coord
Output:
lon lat
1 -112.0740 33.44838
2 -118.2437 34.05223
3 -122.6765 45.52306
>