Thông tin dữ liệu: S&P500 stock data
BỘ dữ liệu về chứng khoán của tất cả công ty có trong S&P500 thời gian từ ngày 08/02/2013 đến ngày 10/09/2014
Mô tả dữ liệu:
Thông tin dữ liệu được mô tả ở các cột sau :
Link download : https://docs.google.com/spreadsheets/d/14GTxp_yktiXY_s7B6zZULs3XlUiLq0aJ/edit?usp=sharing&ouid=115122603206656803042&rtpof=true&sd=true
library(readxl)
library(DT)
# Đọc thông tin file
stock <- read_excel("d:/stock.xlsx")
# Hiển thị số dòng mỗi trang
line <- 10
# Xem kết quả
datatable(stock, options = list(pageLength = line))
## Warning in instance$preRenderHook(instance): It seems your data is too big for
## client-side DataTables. You may consider server-side processing:
## https://rstudio.github.io/DT/server.html
# Tải các gói cần thiết
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
# Chuyển đổi cột 'Ngày' sang kiểu dữ liệu ngày
date_sp500 <- as.Date(stock$date)
# Vẽ biểu đồ giá đóng cửa
ggplot(stock, aes(x = date_sp500, y = `close`)) +
geom_line() +
labs(title = "Biểu đồ giá cổ phiếu S&P 500",
x = "Ngày",
y = "Giá đóng cửa") +
theme_minimal()