2017-01-02 82 views
-1

我想從我的readline /輸入功能通過符號功能(readstock)局部變量通在功能之外的功能

readinteger <- function() 
{ 
    symbol <- readline(prompt="Enter an symbol: ") 
    return(as.character(symbol)) 
} 

# return df of stock value for x history 

readinteger() 

stock <- paste("YAHOO/",symbol) 

df <- Quandl(stock) 

爲什麼這不是我可以打電話符號返回一個對象我的貼?

回答

0

更新:Got it!只需使用全功能調用作爲對象!

stock <- paste("YAHOO/",readstock())