Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎么建立目录捏 #2

Closed
cloudly opened this issue Apr 10, 2012 · 19 comments
Closed

怎么建立目录捏 #2

cloudly opened this issue Apr 10, 2012 · 19 comments

Comments

@cloudly
Copy link
Owner

cloudly commented Apr 10, 2012

在MD格式下,怎么自动生成目录呢?一是最好可以跟PDF或者CHM似的,成为左侧的书签/导航栏;二也是方便自己看一下文档的层次结构,有没有漏掉的、需要添加的之类的。

有什么好办法么?

@yihui
Copy link
Collaborator

yihui commented Apr 10, 2012

安装pandoc,然后再运行./knit html就会生成一个完整的带目录的HTML文件。不过目前你的R代码有些地方好像还有问题,至少上次我运行knitr编译通不过。还有一个地方可能用了edit()或fix(),这样的函数最好不要用,原因有二:

  1. 它们鼓励用户在R里面通过界面的方式修改数据,这是很糟糕的数据处理方式,不可重复;所有数据修改一定要用代码改;
  2. 代码运行到这里会停下来等待用户操作,比如跑knitr的时候。

@cloudly
Copy link
Owner Author

cloudly commented Apr 10, 2012

嗯 是有edit()出现,只是为了举例……其实前面就给出替代方案了……

已经修正了,你试试能跑出结果来了么?

@yihui
Copy link
Collaborator

yihui commented Apr 10, 2012

其实你不必删除,用选项eval=FALSE就可以了

@yihui
Copy link
Collaborator

yihui commented Apr 10, 2012

编译出来的文件已经上传到:https://github.com/cloudly/Play-Econometrics-with-R/downloads

放在库目录下就可以看了。我看了一下HTML输出,有一肚子建议,等我抽空一一提出。

@cloudly
Copy link
Owner Author

cloudly commented Apr 10, 2012

嗯嗯 有没编译出来的地方,还有各种typo...不过看到一个成型的东西,感觉还是蛮开心的,哈哈~~~~

2012/4/10 Yihui Xie <
reply@reply.github.com

编译出来的文件已经上传到:https://github.com/cloudly/Play-Econometrics-with-R/downloads

放在库目录下就可以看了。我看了一下HTML输出,有一肚子建议,等我抽空一一提出。


Reply to this email directly or view it on GitHub:

#2 (comment)

Find me at www.cloudlychen.net

M.Sc Economics
Barcelona Graduate School of Economics
Ramon Trias Fargas, 25-27
08005 Barcelona
Google Talk: xinxing0033@gmail.com

@yihui
Copy link
Collaborator

yihui commented Apr 10, 2012

是啊,写这种和程序有关的文档最爽的就是编完一看,图啊表啊代码啊神马的全都冒出来了,相当有成就感(其实有时候也就是在撑页数,哈哈)

@cloudly
Copy link
Owner Author

cloudly commented Apr 11, 2012

我还是没搞定…… knit 是用R调用么?

我在win 7下,输入 Rscript knit html
报错为:
Error: could not find function "pat_gfm"

@yihui
Copy link
Collaborator

yihui commented Apr 11, 2012

markdown的支持是我在最新的开发版本中支持的,所以你需要安装开发版本:

https://github.com/yihui/knitr#readme

不过建议你明天再装,因为这里面还有些不成熟的东西我正在微调,快调完了。

@yihui
Copy link
Collaborator

yihui commented Apr 14, 2012

代码中错误太多啊,我都不忍心跑下去了:)

@cloudly
Copy link
Owner Author

cloudly commented Apr 14, 2012

还有很多错误?呃....

@yihui
Copy link
Collaborator

yihui commented Apr 14, 2012

你跑一遍就知道了

@cloudly
Copy link
Owner Author

cloudly commented Apr 15, 2012

抱歉刚刚从杭州回来……哈哈这周末useR们在上海玩的很开心 :D 我已经开始当knitr的小白鼠了,fighting~

@yihui
Copy link
Collaborator

yihui commented Apr 15, 2012

木事儿,玩得开心就好

@cloudly
Copy link
Owner Author

cloudly commented Apr 15, 2012

plot()搞不定……5555

@yihui
Copy link
Collaborator

yihui commented Apr 15, 2012

有啥搞不定的啊?图形都会自动处理,比如

``` {r plot-demo}
plot(1)
```

@cloudly
Copy link
Owner Author

cloudly commented Apr 16, 2012

.有几个比较诡异的问题:
比如这行,

names(sample)[2] <- "RECORD_DAY"

## Error: names() applied to a non-vector

还有这种报错:

## Error: object of type 'closure' is not subsettable

都是为啥啊...直接在R里运行这些代码是没有问题的啊。

@cloudly
Copy link
Owner Author

cloudly commented Apr 16, 2012

还有这种错误。。。。

## Error: cannot open file 'cache-upload/sur_1fc09f25342da747c062498313dc32c6.rdb': No such file or directory

@yihui
Copy link
Collaborator

yihui commented Apr 16, 2012

names(sample)[2]错误我回头检查一下,不过sample显然是一个糟糕的名字(况且它还是R自带的函数);关于变量名命名,记住这句话:

你不会给你的猫起名叫“猫”,给狗起名为“狗”,所以不要给样本起名叫“sample”,不要给数据起名叫“data”

命名是编程中最难的部分之一。

@yihui yihui closed this as completed in 7aea43c Apr 16, 2012
@yihui
Copy link
Collaborator

yihui commented Apr 16, 2012

我查了几个小时,终于找出图片出错的原因了。说起来话太长,解决方案和简单的解释参见 7aea43c

其它的错误要是还存在请新开issue讨论。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants