File tree Expand file tree Collapse file tree 1 file changed +93
-0
lines changed
docs/content/doc/usage/packages Expand file tree Collapse file tree 1 file changed +93
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ date : " 2023-01-01T00:00:00+00:00"
3
+ title : " CRAN 软件包注册表"
4
+ slug : " cran"
5
+ draft : false
6
+ toc : false
7
+ menu :
8
+ sidebar :
9
+ parent : " packages"
10
+ name : " CRAN"
11
+ weight : 35
12
+ identifier : " cran"
13
+ ---
14
+
15
+ # CRAN 软件包注册表
16
+
17
+ 将 [ R] ( https://www.r-project.org/ ) 软件包发布到您的用户或组织的类似 [ CRAN] ( https://cran.r-project.org/ ) 的注册表。
18
+
19
+ ** 目录**
20
+
21
+ {{< toc >}}
22
+
23
+ ## 要求
24
+
25
+ 要使用CRAN软件包注册表,您需要安装 [ R] ( https://cran.r-project.org/ ) 。
26
+
27
+ ## 配置软件包注册表
28
+
29
+ 要注册软件包注册表,您需要将其添加到 ` Rprofile.site ` 文件中,可以是系统级别、用户级别 ` ~/.Rprofile ` 或项目级别:
30
+
31
+ ```
32
+ options("repos" = c(getOption("repos"), c(gitea="https://gitea.example.com/api/packages/{owner}/cran")))
33
+ ```
34
+
35
+ | 参数 | 描述 |
36
+ | ------- | -------------- |
37
+ | ` owner ` | 软件包的所有者 |
38
+
39
+ 如果需要提供凭据,可以将它们嵌入到URL(
` https://user:[email protected] /... ` )中。
40
+
41
+ ## 发布软件包
42
+
43
+ 要发布 R 软件包,请执行带有软件包内容的 HTTP ` PUT ` 操作。
44
+
45
+ 源代码软件包:
46
+
47
+ ```
48
+ PUT https://gitea.example.com/api/packages/{owner}/cran/src
49
+ ```
50
+
51
+ | 参数 | 描述 |
52
+ | ------- | -------------- |
53
+ | ` owner ` | 软件包的所有者 |
54
+
55
+ 二进制软件包:
56
+
57
+ ```
58
+ PUT https://gitea.example.com/api/packages/{owner}/cran/bin?platform={platform}&rversion={rversion}
59
+ ```
60
+
61
+ | 参数 | 描述 |
62
+ | ---------- | -------------- |
63
+ | ` owner ` | 软件包的所有者 |
64
+ | ` platform ` | 平台的名称 |
65
+ | ` rversion ` | 二进制的R版本 |
66
+
67
+ 例如:
68
+
69
+ ``` shell
70
+ curl --user your_username:your_password_or_token \
71
+ --upload-file path/to/package.zip \
72
+ https://gitea.example.com/api/packages/testuser/cran/bin? platform=windows& rversion=4.2
73
+ ```
74
+
75
+ 如果同名和版本的软件包已存在,则无法发布软件包。您必须首先删除现有的软件包。
76
+
77
+ ## 安装软件包
78
+
79
+ 要从软件包注册表中安装R软件包,请执行以下命令:
80
+
81
+ ``` shell
82
+ install.packages(" {package_name}" )
83
+ ```
84
+
85
+ | 参数 | 描述 |
86
+ | -------------- | ----------------- |
87
+ | ` package_name ` | The package name. |
88
+
89
+ 例如:
90
+
91
+ ``` shell
92
+ install.packages(" testpackage" )
93
+ ```
You can’t perform that action at this time.
0 commit comments