readcsvfile {bootstrap}R Documentation

Usage

readcsvfile()

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--    or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function(){
        require(package=tcltk)
        #read the file
        fileName<-tclvalue(tkgetOpenFile(filetypes = "{{CSV Files} {.csv}}", title="Please load your loss triangle data"))

        if (!nchar(fileName))
            tkmessageBox(message="No file was selected!")
        else{
                #form the triangle object, the  colClasses="numeric" parameter is limiting the user input, so I will do
                #conversion here.
                t<-read.csv(fileName, head=TRUE, sep=",", row.names=1)
                names(t)<-substr(names(t), 2, nchar(names(t)))

                #make everything to double value,
                for (n in (1 : length(names(t)))){
                        t[,n]<-as.double(gsub(',', '',t[,n]))
                }

                #initialize the triangle
                #attributes(t)

                return (data.matrix(t))
        }
  }

[Package bootstrap version 1.0-1 Index]