Description Usage Arguments Value Examples
View source: R/scrape_more2firm.r
This function scrapes stock price data of
two or more stocks by using the loop syntax of scrape_onefirm
.
With the append
option,
you can select whether to obtain the data
combining the data of each brand in the row direction or
to obtain it from the list composed of the data of each brand.
1 2 3 4 5 6 7 8 | scrape_more2firm(
code,
name = NULL,
start_date,
end_date,
datatype,
append = TRUE
)
|
code |
numeric vector. Specify brand codes. |
name |
character vector. Specify company name.
If specified, ignore |
start_date |
numeric. Specify the start date of the stock price data you want to acquire in the format of yyyymmdd. |
end_date |
numeric. Specify the end date of the stock price data you want to acquire in the format of yyyymmdd. |
datatype |
character. Specify the type of stock price data.
If |
append |
logical.
Do you want to combine the stock price data of each stock
in the row direction? Default is |
If append = TRUE
,
return a tibble object containing stock price data of multiple brands.
If append = FALSE
,
return a list object in which
the stock price data of each brand is an element.
The name of each element is a string with "b"
in front of the corresponding brand code.
For example, if the brand code is 1000,
the stock price data for that brand
can be obtained with (object name)$b1000
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # Combine the 2014 monthly stock price data of
# Sony Group (6758) and Nintendo Co., Ltd. (7974)
# into one data frame
scrape_more2firm(
c(6758, 7974),
start_date = 20140101,
end_date = 20141231,
datatype = "m"
)
# Combine the 2014 monthly stock price data of
# APAMAN and YU-WA Creation Holdings
# into one data frame
scrape_more2firm(
name = c("APAMAN", "YU-WA Creation Holdings"),
start_date = 20140101,
end_date = 20141231,
datatype = "m",
)
# Save the 2014 monthly stock price data of
# Sony Group (6758) and Nintendo Co., Ltd. (7974)
# a list named dt
dt <- scrape_more2firm(
c(6758, 7974),
start_date = 20140101,
end_date = 20141231,
datatype = "m",
append = FALSE
)
dt$b6758 #extract Sony Group
dt$b7974 #extract Nintendo
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.