tag 标签: Development经管大学堂:名校名师名课

相关帖子

版块 作者 回复/查看 最后发表
[下载]Sustainable Development:Linking economy, society, environment attachment 环境经济学 tyn 2009-3-4 5 3695 三重虫 2021-7-27 16:02:10
Lucas,R.E.,Jr.(1988)”On the Mechanics of Economic Development” attachment 宏观经济学 xuehe 2007-5-15 10 7050 haiyanyueq157 2021-2-19 19:49:16
[下载]Financial Structure and Economic Growth A Cross-Country Comparison of Banks, attachment 宏观经济学 navytomcat 2007-12-8 7 5549 mynamecz 2020-7-16 22:02:17
[下载]Project Management in New Product Development attachment 商学院 diviny 2009-3-31 11 4623 meya~ 2020-4-2 21:41:04
[原创][推荐]DRUID-Exchange Rate Regimes, Financial Development and ‘Creative Destruc attachment 经济史与经济思想史 xiaoyang 2009-4-22 18 7042 西征将军 2013-9-10 05:40:50
世界经济论坛发布的《Financial Development Index 2008》(PDF,362页) attachment 金融学(理论版) gejg 2009-2-4 3 3428 cheyuebaci 2012-1-24 07:24:29
Financial Applications using Excel Add-in Development in CC++ attachment Excel zhushiyou 2007-7-5 4 4740 ihs 2011-12-5 22:20:25
波特经典《Location, competition,and Economic Development Local clusters 》 attachment 国民经济管理 miaowenbin 2006-3-29 0 3716 miaowenbin 2011-10-18 08:26:53
The Future of Development Financing attachment 金融学(理论版) xumw128 2009-6-15 1 1330 lanceyang1974 2010-5-11 13:46:02
The Inequality of Regional Economic Development in China between 1991 and 2001 attachment 区域经济学 stigler 2009-4-15 4 2798 wenbing9887 2009-8-25 18:12:07
[分享]Healthy, Wealthy, and Wise:Socioeconomic Status,Poor Health in Childhood,and attachment 卫生经济学 ccsxghcwb 2009-4-24 1 3285 心中的鹰 2009-8-24 23:14:58
Private Finance And Economic Development attachment 金融学(理论版) xumw128 2009-6-15 0 1220 xumw128 2009-6-15 09:59:42
[下载][分享]Excel Add-in Development in C C++ - Applications for Finance attachment 金融学(理论版) yhongl12 2009-6-3 5 2309 Lucian7L 2009-6-11 01:56:00
solution manule of development economics ray 1998? 发展经济学 tccheyi 2009-6-10 0 4086 tccheyi 2009-6-10 23:08:00
Developments on Experimental Economics :This volume on experimental economics of attachment 行为经济学与实验经济学 shikelang 2008-6-2 3 3904 兵哥哥 2009-4-30 08:19:00
[下载] Financial application using excel add-in development in C++ (Wiley Finance) attachment 金融学(理论版) raymondso 2008-12-7 0 5372 raymondso 2008-12-7 09:36:00
[下载]City Cluster Development attachment 国民经济管理 tyn 2008-12-2 0 2447 tyn 2008-12-2 02:10:00
Development of the American Economy 宏观经济学 闲人 2004-6-20 1 7555 szgjs 2008-7-17 21:10:00
Financial Reform and Economic Development in China attachment 金融学(理论版) mimi_007705 2008-4-21 0 2171 mimi_007705 2008-4-21 22:25:00
Lucas的经典论文:On the Mechanics of Economic Development attachment 国民经济管理 hallery_kong 2008-1-20 0 4831 hallery_kong 2008-1-20 14:06:00

相关日志

分享 如何开发R包
一路嘿嘿 2014-8-2 18:21
注: 本文档是Rmd文档,复制下面文本至Rstudio,通过knitr html即可生成html格式文本 --- output: html_document: default pdf_document: includes: in_header: header.tex keep_tex: yes latex_engine: xelatex --- ```{r setup, include=FALSE} library(knitr) library(hello) opts_chunk$set(fig.width=8, fig.height=5) knit_hooks$set(htmlcap = function(before, options, envir) { if(!before) { paste('p class="caption" style="text-align: center; font-size: 20px; color: blue"',options$htmlcap,"/p",sep="") } }) set.seed(60823316) ``` STYLE type="text/css" h1,h2,h3,h4{ color: royalblue; } h1,h2,h5,h6{ text-align: center; } h2{ font-family: palatino, georgia, serif; } body{ font-size: 0.9em; line-height: 23px; } h3{ font-weight: normal; } h6{ font-size: 0.9em; font-weight: normal; line-height: 5px; } hr{ border-top-style: solid; border-top-width: medium; } code { font-size: 80%; line-height: 140%; border: 1px solid #ccc; } @media print{ hr { visibility: inherit; page-break-before: auto; } p { align. } /STYLE ## R package development ### 一. 系统环境要求 **我用的是windows, linux下没测试过** 1. 需要安装的R包 * devtools:开发R包更容易,提供了`load_all`,`document`,`build`,`check`,`insall`等开发包的函数 * roxygen2:R文档中的注释语句可以自动生成函数的帮助文档Rd文件,不用手动编写 ```{r, eval=FALSE} install.packages("devtools", dependencies = TRUE) install.packages("roxygen2", dependencies = TRUE) ``` 2. 生成手册所需软件 * Rtools: http://cran.r-project.org/bin/windows/Rtools/ * Miktex: http://miktex.org/download、 更多可参考: (https://support.rstudio.com/hc/en-us/articles/200486498-Package-Development-Prerequisites) ### 二. 以Hello包为例说明写包的步骤 1. 加载`devtools`,可以更容易的创建包 ```{r,eval=FALSE} library(devtools) ``` 2. 调用`devtools::create`函数,创建包hello,这样会在工作目录下建立hello文件夹,里面包含了必要的文件: ```{r,eval=FALSE} create("hello") ``` * DESCREPTION:包的描述,包括作者,依赖和导入的其他的包,包的功能等,可以参考 * http://cran.r-project.org/doc/manuals/R-exts.html#The-DESCRIPTION-file * http://adv-r.had.co.nz/Package-basics.html * 包的说明(hello.R):包含了命名空间文件的生成NAMESPACE,命名空间可以查看: * http://adv-r.had.co.nz/Namespaces.html * http://cran.r-project.org/doc/manuals/R-exts.html#Package-namespaces 形如: ```r #' The ReverseEcologyR package #' #' This package implementation the applications of reverse ecology. Reverse #' ecology refers to the use of genomics to study ecology with no a priori #' assumptions about the organism(s) under consideration, linking the organism #' and their environment. Prediction the cooperation among species and hosts. #' #' @name ReverseEcologyR #' @docType package #' @importFrom igraph graph.dfs get.adjacency delete.vertices graph.adjacency #' V V- neighborhood.size plot.igraph print.igraph subcomponent is.igraph #' @importFrom Matrix t #' @importFrom Biobase listLen #' @importFrom KEGGREST keggGet keggList #' @importFrom stringr str_replace_all str_count #' @importFrom XML getNodeSet xmlToList xmlParse #' @importFrom magrittr extract is_greater_than %% #' @importFrom gtools permutations #' @importFrom rlist list.append #' @importFrom mmnet updateKEGGPathway NULL ``` 3. 之后就可以在编写函数,如`hello.R`保存在*R*文件夹下 ```{r,eval=FALSE} #’ a simple example function hello #' a simple example function hello #' @author LiLei #' @details more details #' @export hello - function(){ print("Hello, welcome") } ``` 为了方便在写函数的时候把注释写在`.R`文件中,会调用`roxygen2`自动生成函数的*Rd*文件, 即帮助文档,保存在man文件夹下,详细说明可以看roxygen2的说明文档和http://adv-r.had.co.nz/Documenting-functions.html 4. `load_all`加载所有关于hello包中的信息 ```{r,eval=FALSE} ## change the workspace setwd("./hello") load_all() ``` 5. `document`调用`roxygen2`包生成*Rd*文件和NAMESPACE文件 ```{r,eval=FALSE} document() ``` 6. 接下来就可以利用`build` `install` `check`来创建 安装 检查包 ```{r,eval=FALSE} check() build() install() ``` 安装之后, 可以查看包的帮助文档 ```{r, eval=TRUE} help(package="hello") ``` **上面只是建立一个最简单的包,用到的`devtools`中的函数详细用法可以查看帮助** **关于包中数据的存储,类的操作等可以看相关文档,上面方法是hardley wickham书中adv-r 介绍的过程, 我觉得最简单的一种方法了,碰到什么问题我们也可以共同讨论** ### 三. 资料 ### * http://www.bioconductor.org/developers/package-guidelines/ * http://adv-r.had.co.nz * http://cran.r-project.org/doc/manuals/R-exts.html
11 次阅读|0 个评论

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-1 04:56