Hi Laurent and all, all, all,
Does anyone know any RPy2-friendly way to shut R up while I try to load
libraries? I just want some exception to be through without junk to be
present on std* ...
here is what I am talking about:
In [3]: rpy2.__version__
Out[4]: '2.0.8'
so if I do
import rpy2.robjects
r = rpy2.robjects.r
r.library('glmnet')
I get
Loading required package: Matrix
Loading required package: lattice
which I do not want to appear under no circumstances (makes doctesting ugly
etc), so I came up with a dirty hack:
# To shut R up while it is importing libraries to do not ruin out
# doctests
r.library = lambda libname: \
r("suppressMessages(library(%r))" % libname)
and it seems to do its job if library loads fine, but if it doesn't then
it is ugly again, so following code
# But it becomes really talkative while loading incorrect library
try:
r.library('glmnet_bogus')
except:
pass
pukes on me
Error in library("glmnet_bogus") :
there is no package called 'glmnet_bogus'
What other approaches I could try?
THANKS IN ADVANCE
--
.-.
=------------------------------ /v\ ----------------------------=
Keep in touch // \\ (yoh@|www.)onerussian.com
Yaroslav Halchenko /( )\ ICQ#: 60653192
Linux User ^^-^^ [175555]
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
rpy-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rpy-list