Thanks David for reading for me. Anyhow, is there better way to do looping
on xts objects than using apply? Thanks again.

adschai

On Thu, Jun 25, 2009 at 12:39 AM, David Winsemius <dwinsem...@comcast.net>wrote:

>
> On Jun 24, 2009, at 9:26 PM, R_help Help wrote:
>
>  Hi,
>>
>> I do not understand why after I called apply on a function that returns an
>> xts (getIdvAdjSeries) it returns a matrix whose columns are just numeric
>> value of time series in xts instead of a list of xts objects.
>>
>> Basically, I called the following:
>>
>> apply(matrix(tickers,ncol=1),1,FUN=getDivAdjSeries)
>>
>> getDivAdjSeries <- function(ticker) {
>>   seriesName <- paste(ticker,"Adjusted",sep=".");
>>   command <- parse(text=paste(ticker,"[,'",seriesName,"']",sep=""));
>>   s <- eval(command);
>>   dimnames(s)[[2]] <- ticker;
>>   command <- parse(text=paste(ticker,"@index",sep=""));
>>   s <- xts(s,index=eval(command));
>>   return(s);
>> }
>>
>> This doesn't seem to work. Can anyone shed some light please? Thank you.
>>
>
> That would appear to be the expected behavior after reading the Value
> section of the help page for apply.
>
>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to