I have a piece of script as below:
temp <- getURL("http://chart.yahoo.com/table.csv?s=^HSI&a=0&b=01&c=1900&d=0&e=07&f=2013&g=d&q=q&y=0&z=^HSI&x=.csv",.opts=opts)
write(temp,file="test.txt")
temp <- read.csv("test.txt")
I hate saving it as a txt before import it again as a dataframe, I have heard something like connection, can I skip this “write and load” process?
Another answer shows how to do this in one step by providing a URL to read.csv, the more general case of reading from any text string uses the
textConnectionfunction:With your web page example, this becomes:
but obviously that’s better done with
read.csv("http:/...etc").See
help(connection)for more.