Fatigued R
That's a help. It isn't actually reproducible since I have no idea where for example blpConnect() comes from, but it's still an improvement. Moving the important bit to the top:
The error message I get if the program is not run is: Error in dimnames(x) <- dn : length of 'dimnames' [2] not equal to array extent In addition: Warning message: Index vectors are of different classes: chron chron dates in: merge(d_mer,cdaily)
These seem to mean that your data don't (always?) look like you are expecting, and have nothing to do with fatigue or sleepiness. Except maybe yours? I would suggest going through your function one command at a time (without the loop, but set the loop index manually if needed), and check carefully the format of the data. If it works sometimes and not others, identify a loop index for which it doesn't work and repeat the process. Someone familiar with Bloomberg data might be able to provide more assistance. Sarah
On 2/13/07, Shubha Vishwanath Karanth <shubhak at ambaresearch.com> wrote:
Ohkkk....I will try to do that now....
This is my download function...
download<-function(fil)
{
con<-blpConnect(show.days=show_day, na.action=na_action,
periodicity=periodicity)
for(i in 1:lent)
{
Sys.sleep(3)
cdaily<-blpGetData(con,unique(t[,i]),fil,start=as.chron(as.Date("1/1/199
6", "%m/%d/%Y")),end=as.chron(as.Date("12/28/2006", "%m/%d/%Y")))
#Sys.sleep(3)
if(!exists("d_mer")) d_mer=cdaily else d_mer=merge(d_mer,cdaily)
rm(cdaily)
}
dat<-data.frame(Date=index(d_mer),d_mer)
dat$ABCDEFG=NULL
path1<-paste("D:\\SAS\\Project2\\Daily\\",fil,"_root.sas7bdat",sep="")
path2<-paste("D:\\SAS\\Project2\\Daily\\CODEFILES\\",fil,".sas",sep="")
sasname<-paste(x1,fil,"'",sep="")
write.foreign(dat,path1,path2,package="SAS",dataname=sasname)
blpDisconnect(con)
}
for(j in 1:lenf)
{
fname<-paste("D:\\SAS\\Project2\\Daily\\",filename[j],"_root.sas7bdat",s
ep="")
Sys.sleep(600)
if(!file.exists(fname)) download(fil=filename[j])
}
And lent=58 and lenf=8... 8 text files will be generated in this process
if the program would have run properly, and each would be of size 4,000
KB.
The error message I get if the program is not run is:
Error in dimnames(x) <- dn : length of 'dimnames' [2] not equal to array
extent
In addition: Warning message:
Index vectors are of different classes: chron chron dates in:
merge(d_mer,cdaily)
Please could any one help on this?
-----Original Message-----
From: Sarah Goslee [mailto:sarah.goslee at gmail.com]
Sent: Tuesday, February 13, 2007 7:09 PM
To: Shubha Vishwanath Karanth
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] Fatigued R
Hi Shubha,
Perhaps you haven't gotten any help because you haven't provided a
reproducible example, or even told us what you are trying to do
(specifically)
or what errors you are receiving. Frankly, your problem statement
doesn't
make any sense to me, and I can't provide advice without more
information.
As the footer of every email says:
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Sarah On 2/13/07, Shubha Vishwanath Karanth <shubhak at ambaresearch.com> wrote: Hi R, Please solve my problem........... I am extracting Bloomberg data from R, in a loop. R is getting fatigued by doing this process and gives some errors. I introduced sleep function. Doing this sometimes I get the results and sometimes not. I even noticed that if I give complete rest for R (don't open R window) for 1 day and then run my code with the sleep function, then the program works. But if I keep on doing this with on R, repeatedly I get errors. Please can anyone do something for this? Is there any function of refreshing R completely.....Or any other techniques?...I am really getting bugged with this....... Thanks, Shubha
Sarah Goslee http://www.functionaldiversity.org