How to import fundamentals for stocks by using Quandl package - r

I'm trying to import fundamentals for stocks by using Quandl package,I pulled some data by using this line of code:
mydata <-Quandl("WIKI/AAPL", collapse="quarterly")
However, I don't understend how can I get fundamentals data and not just the price data.
Any Idea how to do that? Also, Is there a way to pull all fundamentals with the same line?

On this site you find all the fundamentals:
http://www.quandl.com/c/stocks/aapl. Just click on the figure (quaterly/anualy) and you will be directed to a page with the data. There is an R button on the right. Clicking it will give you the R-Code.
Example:
Gross-Profit: http://www.quandl.com/SEC/AAPL_GROSSPROFIT_Q-APPLE-INC-AAPL-Quarterly-Gross-Profit
Quandl("SEC/AAPL_GROSSPROFIT_Q",
trim_start="2009-06-27",
trim_end="2014-03-29")
But from my understanding quandl do not have all the fundamental-details like
Bloomberg, Reuters, CapitalIQ.

There can be an issue needing to use different SEC codes to obtain comparable data on different companies so Quandl hss recently provided a harmonized set of tags which can be used for some of the more common data types. In addition to Floo0 references, you might want to check out http://www.quandl.com/help/api-for-stock-data#SEC-Harmonized-Data

I got this line of code from the maintainer of the package.There was a typo in the documentation so this is the right syntax:
Quandl("RAYMOND/MSFT_COST_OF_REVENUE_TOTAL_Q", trim_start="2009-06-27", trim_end="2014-03-29")

Related

Hierarchical bar charts in r

I'm working on a visualization project in R and thought of creating bar charts for hierarchical data (states with constituencies in it, each constituency possessing a numeric value).
I came across this web page (https://observablehq.com/#d3/hierarchical-bar-chart) which implements exactly this using library "d3" but for JavaScript.
Is there any similar library in R to do this?
I also had similar question before! But I couldn't find any package or code online that does the same thing in R, the closest thing I found was "r2d3" package which allows you to run javascript in R.
So by leveraging the "r2d3" package, I was able to replicate it and put it into a function call "hbar", you can directly source it from my github with the code below:
source("https://raw.githubusercontent.com/JohnnyPeng123/hierarchical_bar_chart-/master/hbar.r")
For more details and use case please follow the link below:
https://github.com/JohnnyPeng123/hierarchical_bar_chart-
Let me know if you need any help in terms of using this function.
You can use ggplot.
If you need more help, please share a reproductive example.

Identifying required packages from code

I want to follow the tutorial found on this site, but despite being thorough in all other aspects, the author has not included information on what packages need to be used for the code to function.
As far as I understand one of them will be the PerformanceAnalytics package, yet my inexperienced eye is not sure about what else I will need to include.
The fapply function used in the code is one example that I cannot find.
fapply()
Error: could not find function "fapply"
library(sos)
findFn("fapply", sortby = "Function")
The findFN(...) function is great. It should open an internet browser window with the search results by itself at least it does for me.
The tutorial on Backtesting a Trading Strategy uses time series data as seen its part 1 and part 2. fapply is also used in part 2
As the data being collected and processed is time-series data, fapply() function belongs to far package which is used for Modelization for Functional AutoRegressive Processes.
I hope this helps.

Text Categorization In R for single paragraph

I have been searching for a solution/library or any function that performs text categorization of a single paragraph without any training involved in R. I need to categorize/classify contact center call data individually. The calls need to be categorized according to the terms used by the agent or caller. The terms may not be consecutive, and so it doesn't follow bigram.
For example, the following sample text should be categorized something like "Router Internet issues"
"Hello thank you for calling XYZ solutions. This is Mark. How can I help you?
Hi, I have been facing issues in connecting to internet. There seems to be some issue with my router. "
I have tried OpenNLP, RTextTools libraries in R, but could not figure out how to process a single paragraph. Does anyone have any ideas? Any help is appreciated.
Edited
As I am a beginner in R so would much appreciate a thorough solution if possible
It looks like you are trying to extract keywords from a document and using those as tags/labels. You may want to look at this R package {RKEA} - http://www.nzdl.org/Kea/Download/Kea-5.0-Readme.txt

How to see which data is used in an example of a package

I am using the library(eventstudies)(Event Studies Package). In the sample they use:
(data(StockPriceReturns))
(data(SplitDates))
(head(SplitDates))
However I do not know how to set up my own dataset to use the package. My quesiton is:
How to look into the StockPriceReturns data?
I appreciate your answer!
I think you want to read a data set into a data frame or table.
I'm not familiar with that package, so I'm not sure about required format. If the data set you read in matches the schema of StockPriceReturns, I'm sure R will process it just fine. This PDF appears to explain it well.

Downloading Package "Cart" in R

Does anybody know where I can download the R package "cart" that can help create Gastner's
"Mapping with Diffusion-based Cartograms" ? I tried a install.package on R and says it's not available
for R 2.15. There is a page on R-forge about it but it doesn't explain how to download the package.
Thanks.
Way late to the game, but from what I can tell there's not much happening for the cart package; my recent efforts with cartogramming in R have pushed me towards two alternatives: Rcartogram within R (available from the GitHub repository) and ScapeToad, a program written in JS.
Advantage of the former is that you don't have to leave R (better for long-term project management), however it's a bit arcane to use (requires converting your shapefile to a density grid & then figuring out how to use an interpolation method, etc.).
Advantage of the latter is that it's got a very simple point-and-click GUI--add shapefile, create cartogram wizard, export shapefile, voila.
Both are based on the Gastner-Newman diffusion-based algorithm.
If you check the build page you'll see that at the moment the package fails to build. I thought it might be something minor but I've put in a little bit of work so far and it's still failing to build on my machine.
You might want to email the authors and ask them. You could also try their forum but it looks like it hasn't seen much activity lately.

Resources