【发布时间】:2020-12-14 11:20:50
【问题描述】:
我有两个这样的数据框,其中包含有关求职者的信息:
Scores<-structure(list(Name = c("John Smith", "Jane Doe",
"John Doe", "Jan Jenkins", "Lauren John", "Jennifer Patty",
"Zachary Gala"), `Applicant Name` = c(1, 18, 5, 6, 3, 4, 2),
`Sum-100` = c(75, 85, 97, 53, 61, 31, 85), `Edu.-20` = c(12,
19, 20, 10, 14, 8, 18), `Personality-15` = c(10, 14, 15,
8, 8, 7, 12), `Verbal-15` = c(12, 12, 14, 7, 6, 6, 13), `Maturity-15` = c(14,
11, 15, 8, 8, 5, 13), `Research-15` = c(13, 10, 14, 10, 13,
4, 14), `Intellect-15` = c(16, 19, 19, 10, 11, 1, 15), `LOR-10` = c(NaN,
9, 3, 8, 6, 4, NaN), `PS-10` = c(NaN, 8, 3, 8, 5, 4, NaN)), row.names = c(NA,
-7L), groups = structure(list(Name = c("John Smith", "Jane Doe",
"John Doe", "Jan Jenkins", "Jennifer Patty", "Jennifer Patty",
"Zachary Gala"), .rows = structure(list(1L, 2L, 3L, 4L, 5L, 6L,
7L), ptype = integer(0), class = c("vctrs_list_of", "vctrs_vctr",
"list"))), row.names = c(NA, 7L), class = c("tbl_df", "tbl",
"data.frame"), .drop = TRUE), class = c("grouped_df", "tbl_df",
"tbl", "data.frame"))
Comments<-structure(list(`Applicant Name` = c(1, 1, 2, 2, 3, 2, 2, 3, 3,
4, 5, 6, 3, 3, 1, 1, 18), Name = c("John Smith", "John Smith",
"Zachary Gala", "Zachary Gala", "Lauren John", "Zachary Gala",
"Zachary Gala", "Lauren John", "Lauren John",
"Jennifer Patty", "John Doe", "Jan Jenkins", "Lauren John",
"Lauren John", "John Smith", "John Smith",
"Jane Doe"), Overall = c("overall good and bla bla bla this is a very long comment because I want to see how it works etc. etc. bla",
"cant do it", "breathtaking", "fdwdf wfew", "joke was funny",
"Interesting person", "asdfd asdasf dasjlfoeiwna osdnkdasjbfiabdk hfhajh dsfklhdsakl hfawei uhdk jashfiaw ulhfk jldbkla hbvliub",
"Dumb", "sfdgsv", "do not take this person", "incredible opportunity for us",
"medium plus", "bla", "goao", "dfg", "ffohfosfdosfdifof", "Silly"
)), row.names = c(NA, -17L), class = c("tbl_df", "tbl", "data.frame"
))
我正在编译所有这些数据,并以 pdf 格式显示有关它的图表和表格,我可能会打印这些数据并亲自交给一群审查候选人的人。每个候选人都有一个部分如下所示:
我刚刚让一个审稿人问我是否可以重新组织文档,以便分数较高的申请人将他们的部分放在文档顶部附近。有没有办法用代码做到这一点?值得一提的是,我实际上还没有他们的分数和数据(将在最后一秒来自 redcap 数据库),所以理想情况下,当我获得原始数据时,我可以对其进行编码以自动移动所有内容。物理重组他们的部分在 pdf 中的位置。我可以想象这段代码中有某种过滤器:
kable(School%>%filter(applicant_name=="2")%>%select(-applicant_name))%>%
kable_paper("hover", full_width = F)
这将过滤到具有“第二好的”分数或其他东西的人,但我如何重新组织哪个申请人去哪里的照片?部分标题中的名称是什么?有没有可能?
【问题讨论】:
-
您是否可以重写您的代码以为每个应用程序生成单独的 PDF 文件,然后将它们转储到列表中(可能按名称或代码)。然后,您可以使用与该代码关联的任何属性将各个 PDF 页面组合成一个文档。
标签: r pdf r-markdown