[R-sig-Finance] [R] TsayData

Diethelm Wuertz wuertz at itp.phys.ethz.ch
Mon Jun 12 19:26:37 CEST 2006


Unfortunately, the Tsay data sets got lost in the  fSeries package.

They are downloadable from the authors web site at

http://www.gsb.uchicago.edu/fac/ruey.tsay/teaching/fts/

You can also use the follwing (untested) function to download
the data sets from the web site mentioned above.

Diethelm Wuertz

tsaySeries =
function(query = "d-ibmln", file = "tempfile",
source = "http://www.gsb.uchicago.edu/fac/ruey.tsay/teaching/fts/",
save = FALSE, sepCSV = ";", try = TRUE, ...)
{   # A function implemented by Diethelm Wuertz

    # Description:
    #   Downloads *.dat data sets from R Tsay's textbook
   
    # Value:
    #   A data frame.
       
    # Examples:
    #   tsaySeries(query = "d-ibmln")   1-column
    #   tsaySeries(query = "d-vwew")    3-column

    # FUNCTION:
    
    # Download:
    if (try) {
        # Try for Internet Connection:
        z = try(tsaySeries(query = query, file = file, source = source,
            save = save, try = FALSE))
        if (class(z) == "try-error" || class(z) == "Error") {
            return("No Internet Access")
        } else {
            return(z)
        }
    } else {
        # File name:
        queryFile = paste(query, ".dat", sep = "")
       
        # For S-Plus Compatibility:
        if (class(version) != "Sversion") {
            # R:
            method = NULL
        } else {
            # SPlus
            method = "wget"
        }
   
        # Download and temporarily store:
        download.file(url = paste(source, queryFile, sep = ""),
            destfile = file, method = method)
       
        # Scan the file and transform into data frame:
        ans = read.table(file, ...)
       
        # Save download ?
        if (save) {
            write.table(z, file, quote = FALSE, col.names = FALSE,
                sep = sepCSV)
        } else {
            unlink(file)
        }
       
        # Return Value:
        return(ans)
    }
   
    # Return Value:
    invisible()
}





SUMANTA BASAK wrote:

>Hi,
>
>I'm trying to work with TsayData in fSeries package.
>How can i fetch any time series data of this package.
>Please advice.
>
>Thanks,
>Sumanta Basak.
>
>
>Send instant messages to your online friends http://in.messenger.yahoo.com
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>  
>



More information about the R-SIG-Finance mailing list