Function 我想知道为什么我不能使用这个函数? yahoo

Function 我想知道为什么我不能使用这个函数? yahoo,function,api,yahoo,Function,Api,Yahoo,此代码不起作用,因为。您需要找到此数据的其他来源。这是什么语言?请编辑您的问题,将其作为标记。这似乎是R。该函数有什么问题?您返回了1078字节,这不是预期的吗? yahoo<-function(sym,current = TRUE, a=0,b=1,c=2000,d,e,f,g="d") { if(current){ f<-as.numeric(substr(as.character(Sys.time()),start = 1,stop = 4)) d<-as.n

此代码不起作用,因为。您需要找到此数据的其他来源。

这是什么语言?请编辑您的问题,将其作为标记。这似乎是R。该函数有什么问题?您返回了1078字节,这不是预期的吗?
yahoo<-function(sym,current = TRUE, a=0,b=1,c=2000,d,e,f,g="d")
{
  if(current){
  f<-as.numeric(substr(as.character(Sys.time()),start = 1,stop = 4))
  d<-as.numeric(substr(as.character(Sys.time()),start = 6,stop = 7))-1
  e<-as.numeric(substr(as.character(Sys.time()),start = 9,stop = 10))
}
  require(data.table)
  tryCatch(
  suppressWarnings(
  fread(paste0("http://ichart.yahoo.com/table.csv",
                   "?s=",sym,
                   "&a=",a,
                   "&b=",b,
                   "&c=",c,
                   "&d=",d,
                   "&e=",e,
                   "&f=",f,
                   "&g=",g,
                   "&ignore=.csv"),sep=",")),
    error = function(e) NULL
  )
}