python - 将 R 指定为 nbformat 中的语言
问题描述
使用此处的帮助,我正在编写一个 python 代码来生成一个 Jupyter 笔记本。我的代码如下:
...
code1 = """\
a=[1,2,3]
for x in a:
print(x)"""
cell1=nbf.v4.new_code_cell(code1)
code2="""\
myString <- 'Hello, World!'
print(myString)""" #note that it is in R
cell2=nbf.v4.new_code_cell(code2)
...
我!jupyter nbconvert --execute --inplace test.ipynb
用来执行我的代码,这样我就可以看到输出而无需运行最终的笔记本。
现在问题是我想cell1
使用python运行,这是默认的(我猜)并cell2
使用R。有没有办法实现这一点?谢谢...
解决方案
推荐阅读
- excel - 在行中查找字符串并将整列复制到新工作表
- c++ - 这种 lambda 用法的可能目的是什么?
- random - 用空格替换逗号?Fisher-Yates 随机化
- maven - 安装 DL4J 时构建失败
- dataset - PETS2007 链接断开
- database - Kraken.com - 根据 /public/Trades 端点协调 websocket 交易数据
- sql - 创建表时出现 Oracle 错误。ORA-00998: 必须使用列别名命名此表达式
- javascript - 如何切换多个相同类别的列表
- c++ - 在 FOR LOOP c++ 上输入带有空格的字符串
- database - 为待办事项列表设计一个数据库,用户可以在其中将任务拖放到任何位置