![]() To load it again simply write the following: df <- read.csv("box_dropbox.csv") ![]() To obtain your default directory path you can write the following: dir <- getwd()Īnd now we save our data: write.csv(df, "box_dropbox.csv") To export a data frame to a CSV file in R, you will need to use the write.csv() command where you specify the data frame and the directory path. Merged <- merge(boxx, dropbox, by=c("date"))ĭf = subset(merged, select=c("date","adjusted.x","adjusted.y")) Now, let’s merge the data, rename the columns, and then take what we need from it into a new data frame for analysis. On the bottom right side of your interface, you can browse through the plots. But our eyes have fooled us enough times in our lives to trust them, especially when it comes to financial matters. Just by eye-balling, we can state that the stocks have indeed moved in a similar fashion. Now that the library is installed let’s load it and obtain stock data for Box and Dropbox. You’ll see your console being populated and if it gets cluttered at any moment you can press CTRL + L to clear it out. If the library isn’t installed you can obtain it with the following command: install.packages("tidyquant") Stock data can be downloaded in many ways with R and we will use the tidyquant library that was built for handling financial data. We will use R studio without any fancy code for our analysis, and I’ll explain it bit by bit. If you’re unfamiliar with the R basics or would like a refresher on it, I’d advise skimming through some bits in this article. You can read more about it here, and you can also check out our cluster analysis article. The analysis that we’re going to perform can inform your domain knowledge when setting up a pair’s trading strategy. For the showcase of these procedures, we will use the Box and Dropbox stocks. In order to do this properly some of the main statistical methods that we need to use are the following:Įach of the above-mentioned procedures will help us to uncover the real relationship between two or more stocks. In this article, we will address the problem of finding stocks that move in a similar matter over a certain time frame. In other words, it is the quantitative analysis of economic phenomena.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |