How to suppress getSymbols error message

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to suppress getSymbols error message

George Kumar
Hi all,

I am using getSymbols to with the following options:

setDefaults(getSymbols,src='csv')

The problem is that when it cannot find the file locally it gives an error
message like the following:

file  abcd.csv does not exist  in   ....skipping ..

It is coming from the following lines of source code:

 if(!file.exists(sym.file)) {
      cat("\nfile ",paste(Symbols[[i]],extension,sep='.')," does not exist ",
          "in ",dir,"....skipping\n")
      next
 }

If would have been nice if the cat statement above was under a if (verbose)

check.

Anyway to suppress this message ? I have tried using try statement too.
Still no luck.

Thanks in advance.
George

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: How to suppress getSymbols error message

Michael Weylandt
You can use a sink(NULL) (R equivalent of >/dev/null) to suppress all
output temporarily.

As far as I know, there's no simple way to just catch this one cat().

On Tue, Dec 29, 2015 at 12:34 AM, George Kumar <[hidden email]> wrote:

> Hi all,
>
> I am using getSymbols to with the following options:
>
> setDefaults(getSymbols,src='csv')
>
> The problem is that when it cannot find the file locally it gives an error
> message like the following:
>
> file  abcd.csv does not exist  in   ....skipping ..
>
> It is coming from the following lines of source code:
>
>  if(!file.exists(sym.file)) {
>       cat("\nfile ",paste(Symbols[[i]],extension,sep='.')," does not exist ",
>           "in ",dir,"....skipping\n")
>       next
>  }
>
> If would have been nice if the cat statement above was under a if (verbose)
>
> check.
>
> Anyway to suppress this message ? I have tried using try statement too.
> Still no luck.
>
> Thanks in advance.
> George
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: How to suppress getSymbols error message

George Kumar
Hi Michael,

Thanks a lot for replying. This is exactly I ended up doing. I wrapped the
offending code around sink("/dev/null") and sink(). This seems to have
solved my problem for the time being.

Best Regards.
George

On Tue, Dec 29, 2015 at 9:38 AM, Michael Weylandt <
[hidden email]> wrote:

> You can use a sink(NULL) (R equivalent of >/dev/null) to suppress all
> output temporarily.
>
> As far as I know, there's no simple way to just catch this one cat().
>
> On Tue, Dec 29, 2015 at 12:34 AM, George Kumar <[hidden email]>
> wrote:
> > Hi all,
> >
> > I am using getSymbols to with the following options:
> >
> > setDefaults(getSymbols,src='csv')
> >
> > The problem is that when it cannot find the file locally it gives an
> error
> > message like the following:
> >
> > file  abcd.csv does not exist  in   ....skipping ..
> >
> > It is coming from the following lines of source code:
> >
> >  if(!file.exists(sym.file)) {
> >       cat("\nfile ",paste(Symbols[[i]],extension,sep='.')," does not
> exist ",
> >           "in ",dir,"....skipping\n")
> >       next
> >  }
> >
> > If would have been nice if the cat statement above was under a if
> (verbose)
> >
> > check.
> >
> > Anyway to suppress this message ? I have tried using try statement too.
> > Still no luck.
> >
> > Thanks in advance.
> > George
> >
> >         [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> > -- Subscriber-posting only. If you want to post, subscribe first.
> > -- Also note that this is not the r-help list where general R questions
> should go.
>

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.