pystitch / stitch

Write reproducible reports in Markdown
https://pystitch.github.io
MIT License
441 stars 20 forks source link

Error when trying to create choropleth map using R's choroplethr package #52

Closed pybokeh closed 7 years ago

pybokeh commented 7 years ago

Here's my traceback:

Traceback (most recent call last):
  File "d:\miniconda3\envs\jupyter\lib\runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "d:\miniconda3\envs\jupyter\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "d:\Miniconda3\envs\jupyter\Scripts\stitch.exe\__main__.py", line 9, in <module>
  File "d:\miniconda3\envs\jupyter\lib\site-packages\click\core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "d:\miniconda3\envs\jupyter\lib\site-packages\click\core.py", line 696, in main
    rv = self.invoke(ctx)
  File "d:\miniconda3\envs\jupyter\lib\site-packages\click\core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "d:\miniconda3\envs\jupyter\lib\site-packages\click\core.py", line 536, in invoke
    return callback(*args, **kwargs)
  File "d:\miniconda3\envs\jupyter\lib\site-packages\click\decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "d:\miniconda3\envs\jupyter\lib\site-packages\stitch\cli.py", line 60, in cli
    convert(input_text, to, output_file=output_file, extra_args=extra_args)
  File "d:\miniconda3\envs\jupyter\lib\site-packages\stitch\stitch.py", line 464, in convert
    meta, blocks = stitcher.stitch(source)
  File "d:\miniconda3\envs\jupyter\lib\site-packages\stitch\stitch.py", line 264, in stitch
    name, messages, attrs,
  File "d:\miniconda3\envs\jupyter\lib\site-packages\stitch\stitch.py", line 324, in wrap_output
    key = min(all_data.keys(), key=lambda k: order[k])
ValueError: min() arg is an empty sequence  

My markdown file just contains:

```{ir}
library(choroplethr)
data(df_pop_state)

state_choropleth(df_pop_state, 
             title  = "2012 State Population Estimates",
             legend = "Population")


**EDIT:** forgot to add that the R code works fine in jupyter notebook.  I think perhaps the map that gets generated is too big?
TomAugspurger commented 7 years ago

Thanks for the report. Should be fixed in 2c8a3a7 if you want to give that a shot. Apparently some R output returns empty messages. In python these go over stdout.

pybokeh commented 7 years ago

@TomAugspurger That worked. Thanks Tom!