分类医学变量的数据汇总

问题描述

这是我的数据子集

dput(head(AMC))
structure(list(`NCT Number` = c("NCT03987958","NCT02809092","NCT02860793","NCT04069208","NCT02319135","NCT02920008"),Status = c("Recruiting","Active,not recruiting","Completed","Recruiting","Completed"),`Study Results` = c("No Results Available","No Results Available","No Results Available"),Conditions = c("Acute Myeloid Leukemia","Acute Myeloid Leukemia","Acute Myeloid Leukemia"),Interventions = c(NA,"Biological: NK Cells + Chemotherapy Starting","Other: Bone marrow aspiration|Other: Blood sampling","Drug: Idarubicin and cytarabine induction","Drug: Azacitadine|Drug: Fludarabine|Drug: Cytarabine|Drug: Lenograstim|Drug: Filgastrim","Drug: guadecitabine|Drug: Treatment Choice (TC)"),Gender = c("All","All","All"),Age = c("18 Years and older   (Adult,Older Adult)","2 Years to 59 Years   (Child,Adult)","18 Years and older   (Adult,"18 Years to 60 Years   (Adult)","65 Years and older   (Older Adult)",Older Adult)"),Phases = c(NA,"Phase 1|Phase 2","Not Applicable","Phase 2","Phase 3","Phase 3"),Enrollment = c(100,30,10,42,289,302),`Study Type` = c("Observational","Interventional","Interventional"),`Study Designs` = c("Observational Model: Cohort|Time Perspective: Prospective","Allocation: N/A|Intervention Model: Single Group Assignment|Masking: None (Open Label)|Primary Purpose: Treatment","Allocation: N/A|Intervention Model: Single Group Assignment|Masking: None (Open Label)|Primary Purpose: Basic Science","Allocation: Randomized|Intervention Model: Parallel Assignment|Masking: None (Open Label)|Primary Purpose: Treatment","Allocation: Randomized|Intervention Model: Parallel Assignment|Masking: None (Open Label)|Primary Purpose: Treatment"
    )),row.names = c(NA,-6L),class = c("tbl_df","tbl","data.frame"
))

############################################ ############################

head(AMC)
# A tibble: 6 x 11
  `NCT Number` Status   `Study Results`  Conditions  Interventions       Gender Age      Phases Enrollment `Study Type` `Study Designs`       
  <chr>        <chr>    <chr>            <chr>       <chr>               <chr>  <chr>    <chr>       <dbl> <chr>        <chr>                 
1 NCT03987958  Recruit… No Results Avai… Acute Myel… NA                  All    18 Year… NA            100 Observation… Observational Model: …
2 NCT02809092  Active,… No Results Avai… Acute Myel… Biological: NK Cel… All    2 Years… Phase…         30 Interventio… Allocation: N/A|Inter…
3 NCT02860793  Complet… No Results Avai… Acute Myel… Other: Bone marrow… All    18 Year… Not A…         10 Interventio… Allocation: N/A|Inter…
4 NCT04069208  Recruit… No Results Avai… Acute Myel… Drug: Idarubicin a… All    18 Year… Phase…         42 Interventio… Allocation: N/A|Inter…
5 NCT02319135  Complet… No Results Avai… Acute Myel… Drug: Azacitadine|… All    65 Year… Phase…        289 Interventio… Allocation: Randomize…
6 NCT02920008  Complet… No Results Avai… Acute Myel… Drug: guadecitabin… All    18 Year… Phase…        302 Interventio… Allocation: Randomize…

我如何总结数据,将第一列分开,这是我对地图的引用。

如果我将状态或性别或年龄等放在一起,那就很简单了,但在包含干预的列中,由多个单词组成。我也希望看到总结。

所以离开第一列我的目标是查看数据摘要

如何做,任何建议或帮助将不胜感激

预期输出

table(AMC$Status,AMC$`Study Results`,AMC$`Study Type`),= Expanded Access

                         
                          Has Results No Results Available
  Active,not recruiting            0                    0
  Approved for marketing            0                    2
  Available                         0                    3
  Completed                         0                    0
  Enrolling by invitation           0                    0
  No longer available               0                    2
  Not yet recruiting                0                    0
  Recruiting                        0                    0
  Suspended                         0                    0
  Terminated                        0                    0
  UnkNown status                    0                    0
  Withdrawn                         0                    0,= Expanded Access:Individual Patients

                         
                          Has Results No Results Available
  Active,not recruiting            0                    0
  Approved for marketing            0                    1
  Available                         0                    2
  Completed                         0                    0
  Enrolling by invitation           0                    0
  No longer available               0                    2
  Not yet recruiting                0                    0
  Recruiting                        0                    0
  Suspended                         0                    0
  Terminated                        0                    0
  UnkNown status                    0                    0
  Withdrawn                         0                    0

以上是我的预期输出。但是似乎很难将除第一个变量之外的所有变量放在一个表或一个表中,因为我看到的级别很多。但它可以转换成更简洁的东西吗?而不是做一张桌子

解决方法

这是一个基本的 R 解决方案,其中包含经常被遗忘的函数 ftable

ftable(AMC$Status,AMC$`Study Results`,AMC$`Study Type`)
#                                             Interventional Observational
#                                                                         
#Active,not recruiting No Results Available               1             0
#Completed              No Results Available               3             0
#Recruiting             No Results Available               1             1