[R] Fatigued R

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Tue Feb 13 16:27:40 CET 2007


Shubha,

You suggested the solution yourself: first make sure that the downloaded
data has no errors and reload it when it has errors. But that's
something you'll have to do yourself. Have a look at the data downloaded
with and without errors and try to see the difference. Again: it's
impossible to solve your problem without an example of the correct and
faulty data.

Thierry

------------------------------------------------------------------------
----

ir. Thierry Onkelinx

Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature
and Forest

Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance

Gaverstraat 4

9500 Geraardsbergen

Belgium

tel. + 32 54/436 185

Thierry.Onkelinx op inbo.be

www.inbo.be 

 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt

A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney


-----Oorspronkelijk bericht-----
Van: Shubha Vishwanath Karanth [mailto:shubhak op ambaresearch.com] 
Verzonden: dinsdag 13 februari 2007 16:06
Aan: ONKELINX, Thierry; r-help op stat.math.ethz.ch; sarah.goslee op gmail.com
Onderwerp: RE: [R] Fatigued R

Hi all, thanks for your reply....

But I have to make one thing clear that there are no errors in
programming...I assure that to you, because I have extracted the data
many times from the same program...

The problem is with the connection of R with Bloomberg, sometimes the
data is not fetched at all and so I get the below errors...It is mainly
due to some network jam problems and all...

Could anyone suggest me how to refresh R, or how to always make sure
that the data is downloaded without any errors for each loop? I tried
with Sys.sleep() to give some free time to R...but it is not successful
always...

Could anybody help me out?

Thank you,
Shubha

-----Original Message-----
From: ONKELINX, Thierry [mailto:Thierry.ONKELINX op inbo.be] 
Sent: Tuesday, February 13, 2007 7:56 PM
To: Shubha Vishwanath Karanth; r-help op stat.math.ethz.ch
Subject: RE: [R] Fatigued R

Dear Shubha,

The error message tells you that the error occurs in the line:
	merge(d_mer,cdaily)
And the problem is that d_mer and cdaily have a different class. It
looks as you need to convert cdaily to the correct class (same class as
d_mer).
Don't forget to use traceback() when debugging your program.

You code could use some tweaking. Don't be afraid to add spaces and
indentation. That will make you code a lot more readable.
I noticed that you have defined some variables within your function
(lent, t). This might lead to strange behaviour of your function, as it
will use the global variables. Giving a variable the same name as a
function (t) is confusing. t[2] and t(2) look very similar but do
something very different.
Sometimes it pays off to covert for-loop in apply-type functions.

Cheers,

Thierry
------------------------------------------------------------------------
----

ir. Thierry Onkelinx

Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature
and Forest

Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance

Gaverstraat 4

9500 Geraardsbergen

Belgium

tel. + 32 54/436 185

Thierry.Onkelinx op inbo.be

www.inbo.be 

 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt

A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney


-----Oorspronkelijk bericht-----
Van: r-help-bounces op stat.math.ethz.ch
[mailto:r-help-bounces op stat.math.ethz.ch] Namens Shubha Vishwanath
Karanth
Verzonden: dinsdag 13 februari 2007 14:51
Aan: Sarah Goslee; r-help op stat.math.ethz.ch
Onderwerp: Re: [R] Fatigued R

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 op gmail.com] 
Sent: Tuesday, February 13, 2007 7:09 PM
To: Shubha Vishwanath Karanth
Cc: r-help op 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 op 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

______________________________________________
R-help op 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
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list