楼主: 情迷仲夏夜
2909 8

[问答] 如何用R写一个这样的程序? [推广有奖]

  • 0关注
  • 9粉丝

已卖:698份资源

讲师

10%

还不是VIP/贵宾

-

威望
0
论坛币
4516 个
通用积分
42.2496
学术水平
69 点
热心指数
82 点
信用等级
46 点
经验
6897 点
帖子
519
精华
0
在线时间
272 小时
注册时间
2010-10-26
最后登录
2019-6-18

楼主
情迷仲夏夜 发表于 2016-2-3 22:55:43 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
如何用R写一个这样的程序?
我想写一个能出来这样的数据结果,不知道哪位能帮忙?
12345
12346
12347
12348
12349
12356
12357
12358
。。。
45678
45679
45689
45789
46789
56789
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:如何用 数据结果 不知道 程序 如何

沙发
bbslover 在职认证  发表于 2016-2-3 23:37:52
what is the character for your data, can you say more about your data?

藤椅
情迷仲夏夜 发表于 2016-2-4 00:14:15
I just want write R can generate the following data and then print out the 5 combination numbers (not permutation) for each group/line from 1-9 without same number in each line and no same repeat for all groups, just like the followings:
w1    w2    w3    w4    w5
1     2     3     4     5
1     2     3     4     6
1     2     3     4     7
1     2     3     4     8
1     2     3     4     9
1     2     3     5     6
1     2     3     5     7
1     2     3     5     8
1     2     3     5     9
1     2     3     6     7
1     2     3     6     8
1     2     3     6     9
1     2     3     7     8
1     2     3     7     9
1     2     3     8     9
1     2     4     5     6
1     2     4     5     7
1     2     4     5     8
1     2     4     5     9
1     2     4     6     7
1     2     4     6     8
1     2     4     6     9
1     2     4     7     8
1     2     4     7     9
1     2     4     8     9
1     2     5     6     7
1     2     5     6     8
1     2     5     6     9
1     2     5     7     8
1     2     5     7     9
1     2     5     8     9
1     2     6     7     8
1     2     6     7     9
1     2     6     8     9
1     2     7     8     9
1     3     4     5     6
1     3     4     5     7
1     3     4     5     8
1     3     4     5     9
1     3     4     6     7
1     3     4     6     8
1     3     4     6     9
1     3     4     7     8
1     3     4     7     9
1     3     4     8     9
1     3     5     6     7
1     3     5     6     8
1     3     5     6     9
1     3     5     7     8
1     3     5     7     9
1     3     5     8     9
1     3     6     7     8
1     3     6     7     9
1     3     6     8     9
1     3     7     8     9
1     4     5     6     7
1     4     5     6     8
1     4     5     6     9
1     4     5     7     8
1     4     5     7     9
1     4     5     8     9
1     4     6     7     8
1     4     6     7     9
1     4     6     8     9
1     4     7     8     9
1     5     6     7     8
1     5     6     7     9
1     5     6     8     9
1     5     7     8     9
1     6     7     8     9
2     3     4     5     6
2     3     4     5     7
2     3     4     5     8
2     3     4     5     9
2     3     4     6     7
2     3     4     6     8
2     3     4     6     9
2     3     4     7     8
2     3     4     7     9
2     3     4     8     9
2     3     5     6     7
2     3     5     6     8
2     3     5     6     9
2     3     5     7     8
2     3     5     7     9
2     3     5     8     9
2     3     6     7     8
2     3     6     7     9
2     3     6     8     9
2     3     7     8     9
2     4     5     6     7
2     4     5     6     8
2     4     5     6     9
2     4     5     7     8
2     4     5     7     9
2     4     5     8     9
2     4     6     7     8
2     4     6     7     9
2     4     6     8     9
2     4     7     8     9
2     5     6     7     8
2     5     6     7     9
2     5     6     8     9
2     5     7     8     9
2     6     7     8     9
3     4     5     6     7
3     4     5     6     8
3     4     5     6     9
3     4     5     7     8
3     4     5     7     9
3     4     5     8     9
3     4     6     7     8
3     4     6     7     9
3     4     6     8     9
3     4     7     8     9
3     5     6     7     8
3     5     6     7     9
3     5     6     8     9
3     5     7     8     9
3     6     7     8     9
4     5     6     7     8
4     5     6     7     9
4     5     6     8     9
4     5     7     8     9
4     6     7     8     9
5     6     7     8     9

this result from SAS, but I don't know how to write R and come out result like this.

板凳
yanshuiting 发表于 2016-2-4 02:41:06 来自手机
情迷仲夏夜 发表于 2016-2-4 00:14
I just want write R can generate the following data and then print out the 5 combination numbers (no ...
So easy

报纸
情迷仲夏夜 发表于 2016-2-4 05:51:02
easy? would you show me your R code?

地板
cheetahfly 在职认证  发表于 2016-2-4 09:04:26
easy indeed.
  1. t(combn(9,5))
复制代码
已有 3 人评分经验 学术水平 热心指数 信用等级 收起 理由
ryoeng + 1 热心帮助其他会员
李会超 + 60 精彩帖子
guita + 2 + 2 + 2 精彩帖子

总评分: 经验 + 60  学术水平 + 2  热心指数 + 3  信用等级 + 2   查看全部评分

7
happyqj 学生认证  发表于 2016-2-4 14:52:50
cheetahfly 发表于 2016-2-4 09:04
easy indeed.
精彩,mark之,以后学习

8
情迷仲夏夜 发表于 2016-2-5 03:56:43
cheetahfly 发表于 2016-2-4 09:04
easy indeed.
thanks a lot! how about print out the 5 numbers permutation in each row from 1 to 9?

9
cheetahfly 在职认证  发表于 2016-2-5 09:50:06
情迷仲夏夜 发表于 2016-2-5 03:56
thanks a lot! how about print out the 5 numbers permutation in each row from 1 to 9?
  1. library(gtools)
  2. permutations(9, 5)
复制代码
But, the matrix is huge, don't print it directly.
已有 1 人评分热心指数 收起 理由
ryoeng + 1 热心帮助其他会员

总评分: 热心指数 + 1   查看全部评分

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-8 18:52