ジャーナル/研究論文のタイトルを含む〜5,000行の比較的大きなデータセットがあります。データセットの小さなサンプルを次に示します。
dt = structure(list(Title = c("Community reinforcement approach in the treatment of opiate addicts",
"Therapeutic justice: Life inside drug court", "Therapeutic justice: Life inside drug court",
"Tuberculosis screening in a novel substance abuse treatment center in Malaysia: Implications for a comprehensive approach for integrated care",
"An ecosystem for improving the quality of personal health records",
"Patterns of attachment and alcohol abuse in sexual and violent non-sexual offenders",
"A Model for the Assessment of Static and Dynamic Factors in Sexual Offenders",
"A model for the assessment of static and dynamic factors in sexual offenders",
"The problem of co-occurring disorders among jail detainees: Antisocial disorder, alcoholism, drug abuse, and depression",
"Co-occurring disorders among mentally ill jail detainees. Implications for public policy",
"Comorbidity and Continuity of Psychiatric Disorders in Youth After Detention: A Prospective Longitudinal Study",
"Behavioral Health and Adult Milestones in Young Adults With Perinatal HIV Infection or Exposure",
"Behavioral health and adult milestones in young adults with perinatal HIV infection or exposure",
"Revising the paradigm for jail diversion for people with mental and substance use disorders: Intercept 0",
"Diagnosis of active and latent tuberculosis: summary of NICE guidance",
"Towards tackling tuberculosis in vulnerable groups in the European Union: the E-DETECT TB consortium"
)), row.names = c(NA, -16L), class = c("tbl_df", "tbl", "data.frame"
))
そこにはタイトルの重複がいくつかあることがわかりますが、フォーマット/大文字と小文字が異なります。重複しているタイトルを特定し、どの行が一致する可能性があるかを記録する新しい変数を作成したいと考えています。これを行うために、ここで提案されているように agrep 関数を使用しようとしました:
dt$is.match <- sapply(dt$Title,agrep,dt$Title)
これにより一致が識別されますが、結果は新しい変数列にリストとして保存されます。agrep の結果がリストとして保存されず、どの行が一致するかを識別するだけ (例: 6:7) の場合、これを行う方法はありますか (base r または data.table を使用するのが望ましい)。
事前に感謝します-十分な情報を提供したことを願っています.