楼主: verbatim
857 0

[问答] need help on order of data records changed after merging, thanks [推广有奖]

  • 1关注
  • 3粉丝

已卖:25份资源

博士生

5%

还不是VIP/贵宾

-

威望
0
论坛币
513 个
通用积分
2.0505
学术水平
0 点
热心指数
2 点
信用等级
0 点
经验
3404 点
帖子
139
精华
0
在线时间
143 小时
注册时间
2006-12-1
最后登录
2020-1-30

楼主
verbatim 发表于 2016-7-23 02:29:12 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
d1 = structure(list(ID = c(118L, 115L, 194L, 7L, 747L)), .Names = "ID", row.names = c(NA,
-5L), class = "data.frame")

demo.ph2 = structure(list(ID = c(1L, 1L, 1L, 1L, 1L, 1L, 7L, 7L, 7L, 7L,
7L, 7L, 20L, 20L, 20L, 20L, 20L, 100L, 100L, 100L, 100L, 115L,
115L, 115L, 115L, 118L, 118L, 118L, 118L, 194L, 194L, 194L, 194L,
747L, 747L, 747L, 747L, 1683L, 1683L, 1683L), AST = c(26, 20,
25, 23, 26, 19, 19, 21, 31, 28, 21, 21, 21, 29, 28, 18, 21, 215.4,
12, 18, 92.4, 383.4, 40.2, 28.8, 36.6, 847, 30, 24, 31, 780,
20.4, 18.6, 18.6, 64, 21, 20, 20, 35, 33, 39), ALB = c(40.99999905,
39.00000095, 39.00000095, 37.99999952, 40, 39.00000095, 35.99999905,
35, 35.99999905, 39.00000095, 40.99999905, 37.00000048, 40.99999905,
40.99999905, 40.99999905, 41.99999809, 43.00000191, 37.6, 34.9,
42.2, 41.7, 23, 21, 32, 32, 27.3, 25.9, 34.1, 29.2, 24, 31, 32,
33, 27, 37, 40, 39, 41.99999809, 39.00000095, 40), SEX = c(1L,
1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
1L, 1L, 1L, 1L, 1L, 1L, 1L), RACE = c(1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L)), .Names = c("ID", "AST", "ALB", "SEX", "RACE"), row.names = c("1",
"19", "54", "75", "95", "103", "620", "638", "673", "694", "713",
"721", "1958", "1976", "2011", "2056", "2064", "8462", "8510",
"8551", "8569", "9867", "9909", "9964", "9978", "9997", "10026",
"10057", "10070", "14118", "14160", "14207", "14221", "18608",
"18635", "18673", "18681", "35762", "35780", "35804"), class = "data.frame")

demo <- merge(x=d1, y=demo.ph2, by="ID", all.x=T)


Why is the order of data record of each ID in demo different from the order of data record of each ID in demo.ph2, for example, when we look at order of AST in ID=7? how to make them (for example, AST) in the same order as in demo.ph2? Thanks

二维码

扫码加我 拉你入群

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

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

关键词:RECORDS Changed Record change thanks structure records

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-9 07:58