Suppose I want to regress in R Gross Profit on Total Revenue. I need data for this, and the more, the better.There is a library on CRAN that I find very useful: quantmod , that does what I need.
library(quantmod)getFinancials(Symbol="AMD", src="google")#to get the names of the matrix: rownames(AMD.f$IS$A)Total.Revenue<-AMD.f$IS$A["Revenue",]Gross.Profit<-AMD.f$IS$A["Gross Profit",]#finally:reg1<-lm(Gross.Profit~Total.Revenue)
The biggest issue that I have is that this library gets me data only for 4 years (4 observations, and who runs a regression with only 4 observations???). Is there any other way (maybe other libraries) that would get data for MORE than 4 years?