You can write your own read.xts function. We will call it a wrapper, and it should go something along the lines
read.xts <- function(x, format = "%m/%d/%Y", header = TRUE, sep = ",") { result <- as.xts(read.zoo(x, sep = sep, format = format, header = header)) return(result) } read.xts(file.choose())
Pay attention to the arguments in function() . They are passed to the function body (code between curly braces). If the arguments to function() have values, this means that this is their default value. If you assign new values (for example, function(x = "my.file.csv", sep = "\t") ), they will overwrite the default values. The last line shows how you can use your new function. Feel free to extend this function to the rest of the read.zoo arguments. If you have any specific question on how to do this, feel free to just ask. :)
In my daily work I use several small gems. I created a file called workhorse.R and I upload it (for example, source("d:/workspace/workhorse.R") ) whenever I need any of the small functions.
source share