可重复性研究week2

1.1  coding standards

.常用文本文件/文本编辑器,即 text files/text editor

.缩进代码

。缩进提高可读性

。修正行长(80列)能让你从容的面对嵌套和长函数

。小建议:最少缩进(4个格);8个最理想

.限制代码的宽度(80列?可否随自己)

.限制单个函数的长度,避免又臭又长的函数

1.2 markdown相关文件

What is Markdown?

"Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format(纯文本), then convert it to structurally valid XHTML (or HTML)."


John Gruber, creator of Markdown

  1. Markdown是一名超级简单的书写语言,你可以在1小时内学会它,详细内容点这里
    简书上的介绍

Markdown Resources

What is Markdown?

What is R Markdown?

  • R markdown is the integration of R code with markdown

  • Allows one to create documents containing "live" R code

  • R code is evaluated as part of the processing of the markdown

  • Results from R code are inserted into markdown document

  • A core tool in literate statistical programming


What is R Markdown?

  • R markdown can be converted to standard markdown using the knitr package in R

  • Markdown can be converted to HTML using the markdown package in R

  • Any basic text editor can be used to create a markdown document; no special editing tools needed

  • The R markdown --> markdown --> HTML work flow can be easily managed using R Studio (but not required)

  • These slides were written in R markdown and converted to slides using the slidify package






当然有时也可如下

library(knitr)

setwd(<working directory>)

knit2html("document. Rmd")将输出变为html格式

browseURL("document.html")将上面输出的那个打开

knitr文件的过程(在黑匣子下发生了什么?)

书写RMarkdown文件(.Rmd)

knitr产生了一个Markdown文件(.md)

knitr将Markdown文件转化为HTML(默认)

.rmd-.md-.html

如果没有完成的话,最好不好去碰(比如说edit/save)这些.md或是.html文件



some common Options

.output

-results: "asis","hide"

-echo:TRUE,FALSE

figures

-fig.height:numeric

-fig.width:numeric

asis 意味着不postprocess这结果,而是用原始结果来输出











评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值