#0-1 必要パッケージのDL
library(readxl)
pacman::p_load(tidyverse , RSQLite , lubridate, tableone, skimr)
#0-2 データの読み込み
df2016<-read_csv("C:/Users/eishin/Desktop/machine/machine_database/PER2016.csv")
## Warning: One or more parsing issues, call `problems()` on your data frame for details,
## e.g.:
## dat <- vroom(...)
## problems(dat)
## Rows: 244500 Columns: 147
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): delivery_date
## dbl (141): year, location, serial_num, art, intro, preg_num, deliv_num, pret...
## lgl (5): hellp, laceration_hist, gdm_hist, gastro_chronic, parvo
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
df2017<-read_csv("C:/Users/eishin/Desktop/machine/machine_database/PER2017.csv")
## Warning: One or more parsing issues, call `problems()` on your data frame for details,
## e.g.:
## dat <- vroom(...)
## problems(dat)
## Rows: 236475 Columns: 147
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (5): delivery_date, anes, nst_pattern, fgr, ritodrine_med
## dbl (139): year, location, serial_num, art, intro, preg_num, deliv_num, pret...
## lgl (3): dic_score, leep_hist, infection_hist
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
df2018<-read_csv("C:/Users/eishin/Desktop/machine/machine_database/PER2018.csv")
## Warning: One or more parsing issues, call `problems()` on your data frame for details,
## e.g.:
## dat <- vroom(...)
## problems(dat)
## Rows: 240987 Columns: 147
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (4): pre_weight, anes, induction, hdp
## dbl (129): year, location, serial_num, art, intro, preg_num, deliv_num, pret...
## lgl (14): delivery_date, ur_infection, eclampsia, cerebral_hemo, pulmo_edem...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
df2016 <- subset(df2016, select = -anes)
df2017 <- subset(df2017, select = -anes)
df2018 <- subset(df2018, select = -anes)
#0-3 列名の一致の確認
colnames(df2016)
## [1] "year" "location" "serial_num"
## [4] "art" "intro" "preg_num"
## [7] "deliv_num" "preterm_num" "cs_num"
## [10] "abortion_num" "ka_num" "height"
## [13] "pre_weight" "final_weight" "pre_smoke"
## [16] "smoke" "alcohol" "partn_smoke"
## [19] "partn_alco" "delivery_date" "deliv_week"
## [22] "deliv_day" "age" "mode_deliv"
## [25] "tolac" "bleeding" "induction"
## [28] "dilation" "nst" "variablity"
## [31] "nst_pattern" "nrfs" "complication"
## [34] "th_abortion" "th_abort_bleeding" "ur_infection"
## [37] "periodontitis" "hyperemesis" "anemia"
## [40] "th_preterm" "asthenia" "short_cl"
## [43] "prolapsed" "cerclage" "abruption"
## [46] "hdp" "hdp_eo" "hdp_lo"
## [49] "hdp_S" "hdp_H" "hdp_h"
## [52] "hdp_P" "hdp_p" "pprom"
## [55] "pprom_week" "fgr" "gdm"
## [58] "obert_dm" "previa" "low_lying"
## [61] "blood_type" "cam" "oligo_hyd"
## [64] "poly_hyd" "eclampsia" "cerebral_hemo"
## [67] "pulmo_edema" "fatty_liver" "hellp"
## [70] "dic" "dic_score" "death"
## [73] "multiple_preg" "birth_weight" "newborn_death"
## [76] "maternal_hist" "bleeding_hist" "th_ab_hist"
## [79] "th_contract_hist" "th_preterm_hist" "asthenia_hist"
## [82] "laceration_hist" "leep_hist" "conization_hist"
## [85] "hdp_hist" "preeclampsia_hist" "abruption_hist"
## [88] "previa_hist" "pprom_hist" "infection_hist"
## [91] "stillbirth_hist" "fgr_hist" "gdm_hist"
## [94] "maternal_chronic" "nerve_chronic" "resp_chronic"
## [97] "intes_chronic" "appe_chronic" "gastro_chronic"
## [100] "hepa_chronic" "nephrology_chronic" "nephritis_chronic"
## [103] "pyelo_chronic" "cystitis_chronic" "hemato_chronic"
## [106] "cardio_chronic" "thyroid_chronic" "hyperthyro_chronic"
## [109] "hypothyro_chronic" "hasimoto_chronic" "skeleton_chronic"
## [112] "muscle_chronic" "utanomaly_chronic" "myoma_chronic"
## [115] "adnexa_chronic" "trauma_chronic" "mental_chronic"
## [118] "autoimmune_chronic" "hypertension_chronic" "infection"
## [121] "gbs" "chlamydia" "syphilis"
## [124] "hbs" "hcv" "rubella"
## [127] "toxoplasma" "cmv" "htlv_1"
## [130] "hiv" "parvo" "vaginitis"
## [133] "influ" "medication" "steroid"
## [136] "throid_med" "antibio_med_ven" "antibio_med_int"
## [139] "antibio_med_vag" "ritodrine_med" "insulin_med"
## [142] "mg_med" "aspirin_med" "heparin_med"
## [145] "psycho_med" "cablocker_med"
colnames(df2017)
## [1] "year" "location" "serial_num"
## [4] "art" "intro" "preg_num"
## [7] "deliv_num" "preterm_num" "cs_num"
## [10] "abortion_num" "ka_num" "height"
## [13] "pre_weight" "final_weight" "pre_smoke"
## [16] "smoke" "alcohol" "partn_smoke"
## [19] "partn_alco" "delivery_date" "deliv_week"
## [22] "deliv_day" "age" "mode_deliv"
## [25] "tolac" "bleeding" "induction"
## [28] "dilation" "nst" "variablity"
## [31] "nst_pattern" "nrfs" "complication"
## [34] "th_abortion" "th_abort_bleeding" "ur_infection"
## [37] "periodontitis" "hyperemesis" "anemia"
## [40] "th_preterm" "asthenia" "short_cl"
## [43] "prolapsed" "cerclage" "abruption"
## [46] "hdp" "hdp_eo" "hdp_lo"
## [49] "hdp_S" "hdp_H" "hdp_h"
## [52] "hdp_P" "hdp_p" "pprom"
## [55] "pprom_week" "fgr" "gdm"
## [58] "obert_dm" "previa" "low_lying"
## [61] "blood_type" "cam" "oligo_hyd"
## [64] "poly_hyd" "eclampsia" "cerebral_hemo"
## [67] "pulmo_edema" "fatty_liver" "hellp"
## [70] "dic" "dic_score" "death"
## [73] "multiple_preg" "birth_weight" "newborn_death"
## [76] "maternal_hist" "bleeding_hist" "th_ab_hist"
## [79] "th_contract_hist" "th_preterm_hist" "asthenia_hist"
## [82] "laceration_hist" "leep_hist" "conization_hist"
## [85] "hdp_hist" "preeclampsia_hist" "abruption_hist"
## [88] "previa_hist" "pprom_hist" "infection_hist"
## [91] "stillbirth_hist" "fgr_hist" "gdm_hist"
## [94] "maternal_chronic" "nerve_chronic" "resp_chronic"
## [97] "intes_chronic" "appe_chronic" "gastro_chronic"
## [100] "hepa_chronic" "nephrology_chronic" "nephritis_chronic"
## [103] "pyelo_chronic" "cystitis_chronic" "hemato_chronic"
## [106] "cardio_chronic" "thyroid_chronic" "hyperthyro_chronic"
## [109] "hypothyro_chronic" "hasimoto_chronic" "skeleton_chronic"
## [112] "muscle_chronic" "utanomaly_chronic" "myoma_chronic"
## [115] "adnexa_chronic" "trauma_chronic" "mental_chronic"
## [118] "autoimmune_chronic" "hypertension_chronic" "infection"
## [121] "gbs" "chlamydia" "syphilis"
## [124] "hbs" "hcv" "rubella"
## [127] "toxoplasma" "cmv" "htlv_1"
## [130] "hiv" "parvo" "vaginitis"
## [133] "influ" "medication" "steroid"
## [136] "throid_med" "antibio_med_ven" "antibio_med_int"
## [139] "antibio_med_vag" "ritodrine_med" "insulin_med"
## [142] "mg_med" "aspirin_med" "heparin_med"
## [145] "psycho_med" "cablocker_med"
colnames(df2018)
## [1] "year" "location" "serial_num"
## [4] "art" "intro" "preg_num"
## [7] "deliv_num" "preterm_num" "cs_num"
## [10] "abortion_num" "ka_num" "height"
## [13] "pre_weight" "final_weight" "pre_smoke"
## [16] "smoke" "alcohol" "partn_smoke"
## [19] "partn_alco" "delivery_date" "deliv_week"
## [22] "deliv_day" "age" "mode_deliv"
## [25] "tolac" "bleeding" "induction"
## [28] "dilation" "nst" "variablity"
## [31] "nst_pattern" "nrfs" "complication"
## [34] "th_abortion" "th_abort_bleeding" "ur_infection"
## [37] "periodontitis" "hyperemesis" "anemia"
## [40] "th_preterm" "asthenia" "short_cl"
## [43] "prolapsed" "cerclage" "abruption"
## [46] "hdp" "hdp_eo" "hdp_lo"
## [49] "hdp_S" "hdp_H" "hdp_h"
## [52] "hdp_P" "hdp_p" "pprom"
## [55] "pprom_week" "fgr" "gdm"
## [58] "obert_dm" "previa" "low_lying"
## [61] "blood_type" "cam" "oligo_hyd"
## [64] "poly_hyd" "eclampsia" "cerebral_hemo"
## [67] "pulmo_edema" "fatty_liver" "hellp"
## [70] "dic" "dic_score" "death"
## [73] "multiple_preg" "birth_weight" "newborn_death"
## [76] "maternal_hist" "bleeding_hist" "th_ab_hist"
## [79] "th_contract_hist" "th_preterm_hist" "asthenia_hist"
## [82] "laceration_hist" "leep_hist" "conization_hist"
## [85] "hdp_hist" "preeclampsia_hist" "abruption_hist"
## [88] "previa_hist" "pprom_hist" "infection_hist"
## [91] "stillbirth_hist" "fgr_hist" "gdm_hist"
## [94] "maternal_chronic" "nerve_chronic" "resp_chronic"
## [97] "intes_chronic" "appe_chronic" "gastro_chronic"
## [100] "hepa_chronic" "nephrology_chronic" "nephritis_chronic"
## [103] "pyelo_chronic" "cystitis_chronic" "hemato_chronic"
## [106] "cardio_chronic" "thyroid_chronic" "hyperthyro_chronic"
## [109] "hypothyro_chronic" "hasimoto_chronic" "skeleton_chronic"
## [112] "muscle_chronic" "utanomaly_chronic" "myoma_chronic"
## [115] "adnexa_chronic" "trauma_chronic" "mental_chronic"
## [118] "autoimmune_chronic" "hypertension_chronic" "infection"
## [121] "gbs" "chlamydia" "syphilis"
## [124] "hbs" "hcv" "rubella"
## [127] "toxoplasma" "cmv" "htlv_1"
## [130] "hiv" "parvo" "vaginitis"
## [133] "influ" "medication" "steroid"
## [136] "throid_med" "antibio_med_ven" "antibio_med_int"
## [139] "antibio_med_vag" "ritodrine_med" "insulin_med"
## [142] "mg_med" "aspirin_med" "heparin_med"
## [145] "psycho_med" "cablocker_med"
columns_diff_2016_2017 <- setdiff(colnames(df2016), colnames(df2017))
columns_diff_2016_2018 <- setdiff(colnames(df2016), colnames(df2018))
columns_diff_2017_2018 <- setdiff(colnames(df2017), colnames(df2018))
columns_diff_2016_2017
## character(0)
columns_diff_2016_2018
## character(0)
columns_diff_2017_2018
## character(0)
###変数名は一致した。
#0-4 データの統合
df <- rbind(df2016, df2017, df2018)
#0-5 データの確認
sapply(df,class)
## year location serial_num
## "numeric" "numeric" "numeric"
## art intro preg_num
## "numeric" "numeric" "numeric"
## deliv_num preterm_num cs_num
## "numeric" "numeric" "numeric"
## abortion_num ka_num height
## "numeric" "numeric" "numeric"
## pre_weight final_weight pre_smoke
## "character" "numeric" "numeric"
## smoke alcohol partn_smoke
## "numeric" "numeric" "numeric"
## partn_alco delivery_date deliv_week
## "numeric" "character" "numeric"
## deliv_day age mode_deliv
## "numeric" "numeric" "numeric"
## tolac bleeding induction
## "numeric" "numeric" "character"
## dilation nst variablity
## "numeric" "numeric" "numeric"
## nst_pattern nrfs complication
## "character" "numeric" "numeric"
## th_abortion th_abort_bleeding ur_infection
## "numeric" "numeric" "numeric"
## periodontitis hyperemesis anemia
## "numeric" "numeric" "numeric"
## th_preterm asthenia short_cl
## "numeric" "numeric" "numeric"
## prolapsed cerclage abruption
## "numeric" "numeric" "numeric"
## hdp hdp_eo hdp_lo
## "character" "numeric" "numeric"
## hdp_S hdp_H hdp_h
## "numeric" "numeric" "numeric"
## hdp_P hdp_p pprom
## "numeric" "numeric" "numeric"
## pprom_week fgr gdm
## "numeric" "character" "numeric"
## obert_dm previa low_lying
## "numeric" "numeric" "numeric"
## blood_type cam oligo_hyd
## "numeric" "numeric" "numeric"
## poly_hyd eclampsia cerebral_hemo
## "numeric" "numeric" "numeric"
## pulmo_edema fatty_liver hellp
## "numeric" "numeric" "numeric"
## dic dic_score death
## "numeric" "numeric" "numeric"
## multiple_preg birth_weight newborn_death
## "numeric" "numeric" "numeric"
## maternal_hist bleeding_hist th_ab_hist
## "numeric" "numeric" "numeric"
## th_contract_hist th_preterm_hist asthenia_hist
## "numeric" "numeric" "numeric"
## laceration_hist leep_hist conization_hist
## "numeric" "numeric" "numeric"
## hdp_hist preeclampsia_hist abruption_hist
## "numeric" "numeric" "numeric"
## previa_hist pprom_hist infection_hist
## "numeric" "numeric" "numeric"
## stillbirth_hist fgr_hist gdm_hist
## "numeric" "numeric" "numeric"
## maternal_chronic nerve_chronic resp_chronic
## "numeric" "numeric" "numeric"
## intes_chronic appe_chronic gastro_chronic
## "numeric" "numeric" "numeric"
## hepa_chronic nephrology_chronic nephritis_chronic
## "numeric" "numeric" "numeric"
## pyelo_chronic cystitis_chronic hemato_chronic
## "numeric" "numeric" "numeric"
## cardio_chronic thyroid_chronic hyperthyro_chronic
## "numeric" "numeric" "numeric"
## hypothyro_chronic hasimoto_chronic skeleton_chronic
## "numeric" "numeric" "numeric"
## muscle_chronic utanomaly_chronic myoma_chronic
## "numeric" "numeric" "numeric"
## adnexa_chronic trauma_chronic mental_chronic
## "numeric" "numeric" "numeric"
## autoimmune_chronic hypertension_chronic infection
## "numeric" "numeric" "numeric"
## gbs chlamydia syphilis
## "numeric" "numeric" "numeric"
## hbs hcv rubella
## "numeric" "numeric" "numeric"
## toxoplasma cmv htlv_1
## "numeric" "numeric" "numeric"
## hiv parvo vaginitis
## "numeric" "numeric" "numeric"
## influ medication steroid
## "numeric" "numeric" "numeric"
## throid_med antibio_med_ven antibio_med_int
## "numeric" "numeric" "numeric"
## antibio_med_vag ritodrine_med insulin_med
## "numeric" "character" "numeric"
## mg_med aspirin_med heparin_med
## "numeric" "numeric" "numeric"
## psycho_med cablocker_med
## "numeric" "numeric"
#0-6 新規変数の作成等
###art_newは0=不妊治療なし 1=人工授精とタイミング 2=art という新たな変数
df$art_new <- as.factor(ifelse(df$art == 0, 0,
ifelse(df$art %in% c(1, 2, 5), 1,
ifelse(df$art %in% c(3, 4), 2, NA))))
###初産婦か経産婦かを分類する二値変数を新たに作る
df$primipara <- ifelse(df$deliv_num >= 1, 1, 0)
###喫煙も、ありとなしでfactor変数を作る
df$pre_smoking<-ifelse(df$pre_smoke>=1,1,0)
df$smoking<-ifelse(df$smoke>=1,1,0)
### "-99"は入力欠測の際に生じるということなので、-99を欠測に変換する
df[c("preg_num", "deliv_num", "preterm_num","cs_num", "abortion_num",
"ka_num","height","pre_weight","final_weight","deliv_week","deliv_day",
"age","bleeding","dic_score","birth_weight")] <-
lapply(df[c("preg_num", "deliv_num", "preterm_num","cs_num", "abortion_num",
"ka_num","height","pre_weight","final_weight","deliv_week","deliv_day",
"age","bleeding","dic_score","birth_weight")], function(x) ifelse(x < 0, NA, x))
### 順序尺度が連続表記になっているため、「最も桁数の高い数」に表記を統一
df[c("art", "nst_pattern","pre_smoke","smoke","alcohol","partn_smoke","nst", "variablity",
"nrfs","th_abortion","hdp_H","hdp_P","hdp_p")] <-
lapply(df[c("art", "nst_pattern","pre_smoke","smoke","alcohol","partn_smoke","nst", "variablity",
"nrfs","th_abortion","hdp_H","hdp_P","hdp_p")], function(x) as.factor(sapply(strsplit(as.character(x), ""), function(y) max(as.numeric(y)))))
## Warning in strsplit(as.character(x), ""): 入力文字列 378249 は不正な UTF-8
## 文字列です
## Warning in strsplit(as.character(x), ""): 入力文字列 398596 は不正な UTF-8
## 文字列です
## Warning in strsplit(as.character(x), ""): 入力文字列 398649 は不正な UTF-8
## 文字列です
## Warning in strsplit(as.character(x), ""): 入力文字列 398761 は不正な UTF-8
## 文字列です
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
## Warning in FUN(X[[i]], ...): 強制変換により NA が生成されました
### 順序尺度のエラー表記を修正する
df[c("preg_num","deliv_num","preterm_num","cs_num", "abortion_num","ka_num")] <-
lapply(df[c("preg_num","deliv_num","preterm_num","cs_num", "abortion_num","ka_num")], function(x) ifelse(x >= 10, NA, x))
### 連続変数のエラーを修正する。
df$height[df$height < 130 | df$height >= 200] <- NA
df$pre_weight[df$pre_weight < 30 | df$pre_weight >= 150] <- NA
df$final_weight[df$final_weight < 30 | df$final_weight >= 150] <- NA
df$age[df$age < 18 | df$age >= 50] <- NA
df$bleeding[df$bleeding >= 20000] <- NA
df$pprom_week[df$pprom_week < 10 | df$pprom_week >= 42] <- NA
df$birth_weight[df$birth_weight < 250 | df$birth_weight >= 5000] <- NA
###エラーで入った文字列を削除する。
df$ritodrine_med[!grepl("^[01]$", df$ritodrine_med)] <- NA
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate '<93>_<93>H'
## to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): input string 449947 is invalid
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): input string 449952 is invalid
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): input string 449955 is invalid
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): input string 449956 is invalid
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): input string 449962 is invalid
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate '<93>_<93>H'
## to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate '<93>_<93>H'
## to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate '<93>_<93>H'
## to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate '<93>_<93>H'
## to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate '<93>_<93>H'
## to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate '<93>_<93>H'
## to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate '<93>_<93>H'
## to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate '<93>_<93>H'
## to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate '<93>_<93>H'
## to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate '<93>_<93>H'
## to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate '<93>_<93>H'
## to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate '<93>_<93>H'
## to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate '<93>_<93>H'
## to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<8c>o<8c><fb>' to a wide string
## Warning in grepl("^[01]$", df$ritodrine_med): unable to translate
## '<93>_<93>H<8c>o<8c><fb>' to a wide string
df$variablity[!grepl("^[01]$", df$variablity)] <- NA
df$induction[!grepl("^[01]$", df$induction)] <- NA
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): input string 615065 is invalid
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): input string 615070 is invalid
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): input string 615087 is invalid
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): input string 615090 is invalid
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): input string 615105 is invalid
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1' to a
## wide string
## Warning in grepl("^[01]$", df$induction): unable to translate '1<81>@1<81>@1'
## to a wide string
df$hdp[!grepl("^[01]$", df$hdp)] <- NA
## Warning in grepl("^[01]$", df$hdp): unable to translate
## '<94>D<90>P<92><86><93>ŏ<c7>' to a wide string
## Warning in grepl("^[01]$", df$hdp): input string 570022 is invalid
## Warning in grepl("^[01]$", df$hdp): unable to translate
## '<94>D<90>P<92><86><93>ŏ<c7>' to a wide string
## Warning in grepl("^[01]$", df$hdp): input string 570049 is invalid
## Warning in grepl("^[01]$", df$hdp): unable to translate
## '<94>D<90>P<92><86><93>ŏ<c7>' to a wide string
## Warning in grepl("^[01]$", df$hdp): input string 570071 is invalid
## Warning in grepl("^[01]$", df$hdp): unable to translate
## '<94>D<90>P<92><86><93>ŏ<c7>' to a wide string
## Warning in grepl("^[01]$", df$hdp): input string 570128 is invalid
## Warning in grepl("^[01]$", df$hdp): unable to translate
## '<94>D<90>P<92><86><93>ŏ<c7>' to a wide string
## Warning in grepl("^[01]$", df$hdp): input string 570176 is invalid
## Warning in grepl("^[01]$", df$hdp): unable to translate
## '<94>D<90>P<92><86><93>ŏ<c7>' to a wide string
## Warning in grepl("^[01]$", df$hdp): unable to translate
## '<94>D<90>P<92><86><93>ŏ<c7>' to a wide string
## Warning in grepl("^[01]$", df$hdp): unable to translate
## '<94>D<90>P<92><86><93>ŏ<c7>' to a wide string
## Warning in grepl("^[01]$", df$hdp): unable to translate
## '<94>D<90>P<92><86><93>ŏ<c7>' to a wide string
## Warning in grepl("^[01]$", df$hdp): unable to translate
## '<94>D<90>P<92><86><93>ŏ<c7>11' to a wide string
## Warning in grepl("^[01]$", df$hdp): unable to translate
## '<94>D<90>P<92><86><93>ŏ<c7>' to a wide string
## Warning in grepl("^[01]$", df$hdp): unable to translate
## '<94>D<90>P<92><86><93>ŏ<c7>' to a wide string
## Warning in grepl("^[01]$", df$hdp): unable to translate
## '<94>D<90>P<92><86><93>ŏ<c7>' to a wide string
## Warning in grepl("^[01]$", df$hdp): unable to translate
## '<94>D<90>P<92><86><93>ŏ<c7>' to a wide string
## Warning in grepl("^[01]$", df$hdp): unable to translate
## '<94>D<90>P<92><86><93>ŏ<c7>' to a wide string
## Warning in grepl("^[01]$", df$hdp): unable to translate
## '<94>D<90>P<92><86><93>ŏ<c7>' to a wide string
## Warning in grepl("^[01]$", df$hdp): unable to translate
## '<94>D<90>P<92><86><93>ŏ<c7>' to a wide string
## Warning in grepl("^[01]$", df$hdp): unable to translate '<91>ٔՌ㌌<8e><ee>' to a
## wide string
df$fgr[!grepl("^[01]$", df$fgr)] <- NA
df$smoke[!grepl("^[012]$", df$smoke)] <- NA
df$pre_smoke[!grepl("^[012]$", df$pre_smoke)] <- NA
### 質的変数のエラーを修正する。
df$tolac[!df$tolac %in% c(0, 1)] <- NA
df$tolac[!df$tolac %in% c(0, 1)] <- NA
df$induction[df$induction >= 2] <- 1
df$tolac[df$tolac >= 2] <- 1
df$dilation[df$dilation >= 2] <- 1
df$variablity[df$variablity >= 3] <- 1
## Warning in Ops.factor(df$variablity, 3): '>=' は因子に対しては無意味です
df$periodontitis[df$periodontitis >= 2] <- 1
df$th_preterm[df$th_preterm >= 2] <- 1
df$short_cl[df$short_cl >= 2] <- 1
df$hdp[df$hdp >= 2] <- 1
df$pprom[df$pprom >= 2] <- 1
df$blood_type[df$blood_type >= 2] <- 1
df$multiple_preg[df$multiple_preg >= 2] <- 1
df$stillbirth_hist[df$stillbirth_hist >= 2] <- 1
df$thyroid_chronic[df$thyroid_chronic < 0] <- 1
df$mental_chronic[df$mental_chronic < 0] <- 1
df$chlamydia[df$chlamydia >= 2] <- 1
df$heparin_med[df$heparin_med >= 2] <- 1
df$aspirin_med[df$aspirin_med >= 2] <- 1
summary(df)
## year location serial_num art
## Min. :2016 Min. : 1.0 Min. :0.000e+00 0 :607076
## 1st Qu.:2016 1st Qu.:101.0 1st Qu.:2.130e+02 1 : 17803
## Median :2017 Median :177.0 Median :5.070e+02 2 : 15110
## Mean :2017 Mean :189.4 Mean :1.898e+20 3 : 45508
## 3rd Qu.:2018 3rd Qu.:283.0 3rd Qu.:1.585e+03 4 : 13956
## Max. :2018 Max. :401.0 Max. :1.370e+26 5 : 22456
## NA's :6 NA's: 53
## intro preg_num deliv_num preterm_num
## Min. :0.0000 Min. :0.000 Min. :0.0000 Min. :0.0
## 1st Qu.:0.0000 1st Qu.:0.000 1st Qu.:0.0000 1st Qu.:0.0
## Median :1.0000 Median :1.000 Median :0.0000 Median :0.0
## Mean :0.7047 Mean :1.329 Mean :0.6745 Mean :0.1
## 3rd Qu.:1.0000 3rd Qu.:2.000 3rd Qu.:1.0000 3rd Qu.:0.0
## Max. :1.0000 Max. :9.000 Max. :9.0000 Max. :9.0
## NA's :6 NA's :900 NA's :1337 NA's :421839
## cs_num abortion_num ka_num height
## Min. :0.0 Min. :0.0 Min. :0.0 Min. :130.0
## 1st Qu.:0.0 1st Qu.:0.0 1st Qu.:0.0 1st Qu.:155.0
## Median :0.0 Median :0.0 Median :0.0 Median :158.0
## Mean :0.3 Mean :0.5 Mean :0.3 Mean :158.3
## 3rd Qu.:0.0 3rd Qu.:1.0 3rd Qu.:0.0 3rd Qu.:162.0
## Max. :9.0 Max. :9.0 Max. :9.0 Max. :197.0
## NA's :390873 NA's :332196 NA's :361560 NA's :67146
## pre_weight final_weight pre_smoke smoke
## Length:721962 Min. : 30.00 0 :475818 0 :548416
## Class :character 1st Qu.: 57.00 2 : 66063 1 : 29410
## Mode :character Median : 62.00 1 : 40450 2 : 10473
## Mean : 63.48 3 : 0 4 : 0
## 3rd Qu.: 68.30 4 : 0 5 : 0
## Max. :149.90 (Other): 0 (Other): 0
## NA's :153962 NA's :139631 NA's :133663
## alcohol partn_smoke partn_alco delivery_date
## 0 :515780 0 : 12914 Min. :0 Length:721962
## 1 : 32308 1 :103704 1st Qu.:1 Class :character
## 2 : 5155 NA's:605344 Median :1 Mode :character
## NA's:168719 Mean :1
## 3rd Qu.:1
## Max. :1
## NA's :584084
## deliv_week deliv_day age mode_deliv
## Min. :22.00 Min. :0.000 Min. :18.00 Min. :1.000
## 1st Qu.:37.00 1st Qu.:1.000 1st Qu.:29.00 1st Qu.:1.000
## Median :38.00 Median :3.000 Median :33.00 Median :1.000
## Mean :38.06 Mean :2.902 Mean :32.50 Mean :1.738
## 3rd Qu.:40.00 3rd Qu.:5.000 3rd Qu.:36.00 3rd Qu.:2.000
## Max. :45.00 Max. :6.000 Max. :49.85 Max. :5.000
## NA's :173 NA's :795 NA's :2526 NA's :4159
## tolac bleeding induction dilation
## Min. :0.0 Min. : 0.0 Length:721962 Min. :0
## 1st Qu.:0.0 1st Qu.: 277.0 Class :character 1st Qu.:1
## Median :0.0 Median : 474.0 Mode :character Median :1
## Mean :0.3 Mean : 620.4 Mean :1
## 3rd Qu.:1.0 3rd Qu.: 800.0 3rd Qu.:1
## Max. :1.0 Max. :17522.0 Max. :1
## NA's :713129 NA's :7184 NA's :666457
## nst variablity nst_pattern nrfs complication
## 0 : 15329 0 :431328 2 : 93016 0 : 6375 Min. :0.0000
## 1 :183389 1 : 10510 3 : 62114 1 : 58556 1st Qu.:0.0000
## 2 :107551 2 : 0 5 : 29100 NA's:657031 Median :1.0000
## 3 : 94534 3 : 0 1 : 28736 Mean :0.6438
## 4 : 42572 NA's:280124 8 : 15138 3rd Qu.:1.0000
## 5 : 3088 (Other): 31271 Max. :1.0000
## NA's:275499 NA's :462587 NA's :1240
## th_abortion th_abort_bleeding ur_infection periodontitis
## 0 : 871 Min. :0.0 Min. :0.0 Min. :0.0
## 1 : 24653 1st Qu.:1.0 1st Qu.:0.0 1st Qu.:0.0
## NA's:696438 Median :1.0 Median :0.0 Median :1.0
## Mean :0.9 Mean :0.5 Mean :0.5
## 3rd Qu.:1.0 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :1.0 Max. :1.0 Max. :1.0
## NA's :711110 NA's :720346 NA's :720089
## hyperemesis anemia th_preterm asthenia
## Min. :0.0 Min. :0 Min. :0 Min. :0.0
## 1st Qu.:1.0 1st Qu.:1 1st Qu.:1 1st Qu.:1.0
## Median :1.0 Median :1 Median :1 Median :1.0
## Mean :0.9 Mean :1 Mean :1 Mean :0.9
## 3rd Qu.:1.0 3rd Qu.:1 3rd Qu.:1 3rd Qu.:1.0
## Max. :1.0 Max. :1 Max. :1 Max. :1.0
## NA's :713744 NA's :633037 NA's :587583 NA's :714240
## short_cl prolapsed cerclage abruption
## Min. :0 Min. :0.0 Min. :0.0 Min. :0.0
## 1st Qu.:1 1st Qu.:1.0 1st Qu.:1.0 1st Qu.:1.0
## Median :1 Median :1.0 Median :1.0 Median :1.0
## Mean :1 Mean :0.8 Mean :0.9 Mean :0.8
## 3rd Qu.:1 3rd Qu.:1.0 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :1 Max. :1.0 Max. :1.0 Max. :1.0
## NA's :686635 NA's :718378 NA's :713837 NA's :713646
## hdp hdp_eo hdp_lo hdp_S
## Length:721962 Min. :0.0 Min. :0 Min. :0.0
## Class :character 1st Qu.:1.0 1st Qu.:1 1st Qu.:0.0
## Mode :character Median :1.0 Median :1 Median :1.0
## Mean :0.9 Mean :1 Mean :0.7
## 3rd Qu.:1.0 3rd Qu.:1 3rd Qu.:1.0
## Max. :1.0 Max. :1 Max. :1.0
## NA's :716391 NA's :697639 NA's :719812
## hdp_H hdp_h hdp_P hdp_p pprom
## 0 : 637 Min. :0 0 : 678 0 : 673 Min. :0
## 1 : 15788 1st Qu.:1 1 : 7306 1 : 10198 1st Qu.:1
## NA's:705537 Median :1 NA's:713978 NA's:711091 Median :1
## Mean :1 Mean :1
## 3rd Qu.:1 3rd Qu.:1
## Max. :1 Max. :1
## NA's :706510 NA's :631207
## pprom_week fgr gdm obert_dm
## Min. :10.0 Length:721962 Min. :0 Min. :0.0
## 1st Qu.:36.0 Class :character 1st Qu.:1 1st Qu.:1.0
## Median :38.0 Mode :character Median :1 Median :1.0
## Mean :36.8 Mean :1 Mean :0.8
## 3rd Qu.:39.0 3rd Qu.:1 3rd Qu.:1.0
## Max. :41.4 Max. :1 Max. :1.0
## NA's :638654 NA's :673143 NA's :714323
## previa low_lying blood_type cam
## Min. :0.0 Min. :0 Min. :0.0 Min. :0.0
## 1st Qu.:1.0 1st Qu.:1 1st Qu.:1.0 1st Qu.:1.0
## Median :1.0 Median :1 Median :1.0 Median :1.0
## Mean :0.9 Mean :1 Mean :0.9 Mean :0.9
## 3rd Qu.:1.0 3rd Qu.:1 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :1.0 Max. :1 Max. :1.0 Max. :1.0
## NA's :710815 NA's :715293 NA's :715571 NA's :715272
## oligo_hyd poly_hyd eclampsia cerebral_hemo
## Min. :0.0 Min. :0.0 Min. :0.0 Min. :0.0
## 1st Qu.:1.0 1st Qu.:1.0 1st Qu.:0.0 1st Qu.:0.0
## Median :1.0 Median :1.0 Median :0.0 Median :0.0
## Mean :0.8 Mean :0.9 Mean :0.4 Mean :0.1
## 3rd Qu.:1.0 3rd Qu.:1.0 3rd Qu.:1.0 3rd Qu.:0.0
## Max. :1.0 Max. :1.0 Max. :1.0 Max. :1.0
## NA's :716409 NA's :709133 NA's :720591 NA's :721011
## pulmo_edema fatty_liver hellp dic
## Min. :0.0 Min. :0.0 Min. :0.0 Min. :0.0
## 1st Qu.:0.0 1st Qu.:0.0 1st Qu.:0.0 1st Qu.:0.0
## Median :0.0 Median :0.0 Median :1.0 Median :1.0
## Mean :0.3 Mean :0.1 Mean :0.7 Mean :0.6
## 3rd Qu.:1.0 3rd Qu.:0.0 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :1.0 Max. :1.0 Max. :1.0 Max. :1.0
## NA's :720620 NA's :720956 NA's :720415 NA's :719849
## dic_score death multiple_preg birth_weight
## Min. : 1 Min. :0.00e+00 Min. :0.00000 Min. : 250
## 1st Qu.: 8 1st Qu.:0.00e+00 1st Qu.:0.00000 1st Qu.:2618
## Median : 9 Median :0.00e+00 Median :0.00000 Median :2932
## Mean :10 Mean :8.03e-05 Mean :0.06274 Mean :2868
## 3rd Qu.:13 3rd Qu.:0.00e+00 3rd Qu.:0.00000 3rd Qu.:3216
## Max. :28 Max. :1.00e+00 Max. :1.00000 Max. :4998
## NA's :721408 NA's :786
## newborn_death maternal_hist bleeding_hist th_ab_hist
## Min. :0.000000 Min. :0.000 Min. :0.0 Min. :0
## 1st Qu.:0.000000 1st Qu.:0.000 1st Qu.:1.0 1st Qu.:1
## Median :0.000000 Median :0.000 Median :1.0 Median :1
## Mean :0.007528 Mean :0.145 Mean :0.8 Mean :1
## 3rd Qu.:0.000000 3rd Qu.:0.000 3rd Qu.:1.0 3rd Qu.:1
## Max. :1.000000 Max. :1.000 Max. :1.0 Max. :1
## NA's :4 NA's :140 NA's :720668 NA's :716781
## th_contract_hist th_preterm_hist asthenia_hist laceration_hist
## Min. :0 Min. :0 Min. :0.0 Min. :0.0
## 1st Qu.:1 1st Qu.:1 1st Qu.:1.0 1st Qu.:0.0
## Median :1 Median :1 Median :1.0 Median :1.0
## Mean :1 Mean :1 Mean :0.9 Mean :0.7
## 3rd Qu.:1 3rd Qu.:1 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :1 Max. :1 Max. :1.0 Max. :1.0
## NA's :703271 NA's :711119 NA's :719164 NA's :721228
## leep_hist conization_hist hdp_hist preeclampsia_hist
## Min. :0.0 Min. :0.0 Min. :0 Min. :0
## 1st Qu.:1.0 1st Qu.:1.0 1st Qu.:1 1st Qu.:1
## Median :1.0 Median :1.0 Median :1 Median :1
## Mean :0.8 Mean :0.9 Mean :1 Mean :1
## 3rd Qu.:1.0 3rd Qu.:1.0 3rd Qu.:1 3rd Qu.:1
## Max. :1.0 Max. :1.0 Max. :1 Max. :1
## NA's :720983 NA's :718839 NA's :709930 NA's :718299
## abruption_hist previa_hist pprom_hist infection_hist
## Min. :0.0 Min. :0.0 Min. :0 Min. :0.0
## 1st Qu.:1.0 1st Qu.:1.0 1st Qu.:1 1st Qu.:1.0
## Median :1.0 Median :1.0 Median :1 Median :1.0
## Mean :0.9 Mean :0.9 Mean :1 Mean :0.8
## 3rd Qu.:1.0 3rd Qu.:1.0 3rd Qu.:1 3rd Qu.:1.0
## Max. :1.0 Max. :1.0 Max. :1 Max. :1.0
## NA's :718883 NA's :719570 NA's :715615 NA's :720802
## stillbirth_hist fgr_hist gdm_hist maternal_chronic
## Min. :0.0 Min. :0.0 Min. :1 Min. :0.0000
## 1st Qu.:1.0 1st Qu.:1.0 1st Qu.:1 1st Qu.:0.0000
## Median :1.0 Median :1.0 Median :1 Median :0.0000
## Mean :0.8 Mean :0.8 Mean :1 Mean :0.3529
## 3rd Qu.:1.0 3rd Qu.:1.0 3rd Qu.:1 3rd Qu.:1.0000
## Max. :1.0 Max. :1.0 Max. :1 Max. :1.0000
## NA's :713211 NA's :714093 NA's :721786 NA's :1254
## nerve_chronic resp_chronic intes_chronic appe_chronic
## Min. :0.0 Min. :0 Min. :0.0 Min. :0
## 1st Qu.:1.0 1st Qu.:1 1st Qu.:1.0 1st Qu.:1
## Median :1.0 Median :1 Median :1.0 Median :1
## Mean :0.9 Mean :1 Mean :0.9 Mean :1
## 3rd Qu.:1.0 3rd Qu.:1 3rd Qu.:1.0 3rd Qu.:1
## Max. :1.0 Max. :1 Max. :1.0 Max. :1
## NA's :712617 NA's :700367 NA's :712586 NA's :719428
## gastro_chronic hepa_chronic nephrology_chronic nephritis_chronic
## Min. :0 Min. :0.0 Min. :0.0 Min. :0.0
## 1st Qu.:1 1st Qu.:1.0 1st Qu.:1.0 1st Qu.:0.0
## Median :1 Median :1.0 Median :1.0 Median :1.0
## Mean :1 Mean :0.8 Mean :0.9 Mean :0.7
## 3rd Qu.:1 3rd Qu.:1.0 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :1 Max. :1.0 Max. :1.0 Max. :1.0
## NA's :720306 NA's :718477 NA's :713388 NA's :719322
## pyelo_chronic cystitis_chronic hemato_chronic cardio_chronic
## Min. :0.0 Min. :0 Min. :0.0 Min. :0.0
## 1st Qu.:0.0 1st Qu.:1 1st Qu.:1.0 1st Qu.:1.0
## Median :1.0 Median :1 Median :1.0 Median :1.0
## Mean :0.6 Mean :1 Mean :0.9 Mean :0.9
## 3rd Qu.:1.0 3rd Qu.:1 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :1.0 Max. :1 Max. :1.0 Max. :1.0
## NA's :719455 NA's :721256 NA's :715321 NA's :712191
## thyroid_chronic hyperthyro_chronic hypothyro_chronic hasimoto_chronic
## Min. :0 Min. :0 Min. :0 Min. :0
## 1st Qu.:1 1st Qu.:1 1st Qu.:1 1st Qu.:1
## Median :1 Median :1 Median :1 Median :1
## Mean :1 Mean :1 Mean :1 Mean :1
## 3rd Qu.:1 3rd Qu.:1 3rd Qu.:1 3rd Qu.:1
## Max. :1 Max. :1 Max. :1 Max. :1
## NA's :692691 NA's :714138 NA's :709187 NA's :715937
## skeleton_chronic muscle_chronic utanomaly_chronic myoma_chronic
## Min. :0 Min. :0 Min. :0.0 Min. :0
## 1st Qu.:1 1st Qu.:1 1st Qu.:1.0 1st Qu.:1
## Median :1 Median :1 Median :1.0 Median :1
## Mean :1 Mean :1 Mean :0.9 Mean :1
## 3rd Qu.:1 3rd Qu.:1 3rd Qu.:1.0 3rd Qu.:1
## Max. :1 Max. :1 Max. :1.0 Max. :1
## NA's :718888 NA's :721399 NA's :718798 NA's :684127
## adnexa_chronic trauma_chronic mental_chronic autoimmune_chronic
## Min. :0 Min. :0.0 Min. :0 Min. :0.0
## 1st Qu.:1 1st Qu.:0.0 1st Qu.:1 1st Qu.:1.0
## Median :1 Median :0.0 Median :1 Median :1.0
## Mean :1 Mean :0.3 Mean :1 Mean :0.9
## 3rd Qu.:1 3rd Qu.:1.0 3rd Qu.:1 3rd Qu.:1.0
## Max. :1 Max. :1.0 Max. :1 Max. :1.0
## NA's :703581 NA's :720837 NA's :699964 NA's :714991
## hypertension_chronic infection gbs chlamydia
## Min. :0.0 Min. :0.0000 Min. :0 Min. :0.0
## 1st Qu.:1.0 1st Qu.:0.0000 1st Qu.:1 1st Qu.:0.0
## Median :1.0 Median :0.0000 Median :1 Median :1.0
## Mean :0.9 Mean :0.1647 Mean :1 Mean :0.7
## 3rd Qu.:1.0 3rd Qu.:0.0000 3rd Qu.:1 3rd Qu.:1.0
## Max. :1.0 Max. :1.0000 Max. :1 Max. :1.0
## NA's :714846 NA's :1251 NA's :639543 NA's :711391
## syphilis hbs hcv rubella
## Min. :0.0 Min. :0.0 Min. :0.0 Min. :0.0
## 1st Qu.:0.0 1st Qu.:0.0 1st Qu.:0.0 1st Qu.:1.0
## Median :0.0 Median :1.0 Median :0.0 Median :1.0
## Mean :0.2 Mean :0.6 Mean :0.3 Mean :0.9
## 3rd Qu.:0.0 3rd Qu.:1.0 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :1.0 Max. :1.0 Max. :1.0 Max. :1.0
## NA's :718074 NA's :717683 NA's :717396 NA's :718638
## toxoplasma cmv htlv_1 hiv
## Min. :0.0 Min. :0.0 Min. :0.0 Min. :0
## 1st Qu.:0.0 1st Qu.:1.0 1st Qu.:0.0 1st Qu.:0
## Median :1.0 Median :1.0 Median :0.0 Median :0
## Mean :0.5 Mean :0.9 Mean :0.4 Mean :0
## 3rd Qu.:1.0 3rd Qu.:1.0 3rd Qu.:1.0 3rd Qu.:0
## Max. :1.0 Max. :1.0 Max. :1.0 Max. :1
## NA's :719337 NA's :720815 NA's :718811 NA's :718751
## parvo vaginitis influ medication
## Min. :0.0 Min. :0 Min. :0 Min. :0.0000
## 1st Qu.:0.0 1st Qu.:1 1st Qu.:1 1st Qu.:0.0000
## Median :1.0 Median :1 Median :1 Median :0.0000
## Mean :0.7 Mean :1 Mean :1 Mean :0.4923
## 3rd Qu.:1.0 3rd Qu.:1 3rd Qu.:1 3rd Qu.:1.0000
## Max. :1.0 Max. :1 Max. :1 Max. :1.0000
## NA's :721465 NA's :714723 NA's :718877 NA's :1250
## steroid throid_med antibio_med_ven antibio_med_int
## Min. :0 Min. :0.0 Min. :0 Min. :0
## 1st Qu.:1 1st Qu.:1.0 1st Qu.:1 1st Qu.:1
## Median :1 Median :1.0 Median :1 Median :1
## Mean :1 Mean :0.9 Mean :1 Mean :1
## 3rd Qu.:1 3rd Qu.:1.0 3rd Qu.:1 3rd Qu.:1
## Max. :1 Max. :1.0 Max. :1 Max. :1
## NA's :698254 NA's :705809 NA's :591381 NA's :664286
## antibio_med_vag ritodrine_med insulin_med mg_med
## Min. :0 Length:721962 Min. :0.0 Min. :0
## 1st Qu.:1 Class :character 1st Qu.:1.0 1st Qu.:1
## Median :1 Mode :character Median :1.0 Median :1
## Mean :1 Mean :0.9 Mean :1
## 3rd Qu.:1 3rd Qu.:1.0 3rd Qu.:1
## Max. :1 Max. :1.0 Max. :1
## NA's :696498 NA's :703107 NA's :690607
## aspirin_med heparin_med psycho_med cablocker_med
## Min. :0.0 Min. :0.0 Min. :0.0 Min. :0.0
## 1st Qu.:1.0 1st Qu.:1.0 1st Qu.:1.0 1st Qu.:1.0
## Median :1.0 Median :1.0 Median :1.0 Median :1.0
## Mean :0.9 Mean :0.8 Mean :0.8 Mean :0.9
## 3rd Qu.:1.0 3rd Qu.:1.0 3rd Qu.:1.0 3rd Qu.:1.0
## Max. :1.0 Max. :1.0 Max. :1.0 Max. :1.0
## NA's :711356 NA's :709979 NA's :712942 NA's :705461
## art_new primipara pre_smoking smoking
## 0 :607076 Min. :0.0000 Min. :0.00 Min. :0.00
## 1 : 47330 1st Qu.:0.0000 1st Qu.:0.00 1st Qu.:0.00
## 2 : 56515 Median :0.0000 Median :0.00 Median :0.00
## NA's: 11041 Mean :0.4845 Mean :0.18 Mean :0.07
## 3rd Qu.:1.0000 3rd Qu.:0.00 3rd Qu.:0.00
## Max. :1.0000 Max. :1.00 Max. :1.00
## NA's :2 NA's :139113 NA's :133658
#0-7 本来は”0”の変数が欠測値として割り当てられている変数について、変換を行う
variables_zero <- c("intro", "preg_num", "deliv_num", "preterm_num",
"cs_num", "abortion_num", "ka_num", "height", "pre_weight",
"final_weight", "alcohol", "partn_smoke", "partn_alco",
"deliv_week", "deliv_day", "age", "mode_deliv",
"tolac", "bleeding", "induction", "dilation",
"variablity", "nrfs", "complication", "th_abortion",
"th_abort_bleeding", "ur_infection", "periodontitis",
"hyperemesis","anemia","th_preterm","asthenia",
"short_cl","prolapsed","cerclage","abruption","hdp",
"hdp_eo","hdp_lo","hdp_S","hdp_H","hdp_h","hdp_P","hdp_p",
"pprom","fgr","gdm","obert_dm","previa", "low_lying",
"blood_type", "cam", "oligo_hyd", "poly_hyd", "eclampsia",
"cerebral_hemo", "pulmo_edema", "fatty_liver", "hellp",
"dic", "newborn_death", "maternal_hist", "bleeding_hist",
"th_ab_hist", "th_contract_hist", "th_preterm_hist",
"asthenia_hist", "laceration_hist", "leep_hist", "conization_hist",
"hdp_hist", "preeclampsia_hist", "abruption_hist", "previa_hist",
"pprom_hist", "infection_hist", "stillbirth_hist", "fgr_hist",
"gdm_hist", "maternal_chronic", "nephritis_chronic", "pyelo_chronic",
"cystitis_chronic", "hemato_chronic", "cardio_chronic", "thyroid_chronic",
"hyperthyro_chronic","hypothyro_chronic","hasimoto_chronic","skeleton_chronic",
"muscle_chronic", "utanomaly_chronic", "myoma_chronic","adnexa_chronic",
"trauma_chronic","mental_chronic","autoimmune_chronic","hypertension_chronic",
"infection","gbs","chlamydia","syphilis","hbs","hcv","rubella","toxoplasma",
"cmv","htlv_1","hiv","parvo","vaginitis","influ","medication","steroid",
"throid_med","antibio_med_ven","antibio_med_int","antibio_med_vag",
"ritodrine_med","insulin_med","mg_med","aspirin_med","heparin_med",
"psycho_med","cablocker_med","art_new","primipara","pre_smoking","smoking")
for (variable in variables_zero) {
df[[variable]] <- ifelse(is.na(df[[variable]]), 0, df[[variable]])
}
summary(df)
## year location serial_num art
## Min. :2016 Min. : 1.0 Min. :0.000e+00 0 :607076
## 1st Qu.:2016 1st Qu.:101.0 1st Qu.:2.130e+02 1 : 17803
## Median :2017 Median :177.0 Median :5.070e+02 2 : 15110
## Mean :2017 Mean :189.4 Mean :1.898e+20 3 : 45508
## 3rd Qu.:2018 3rd Qu.:283.0 3rd Qu.:1.585e+03 4 : 13956
## Max. :2018 Max. :401.0 Max. :1.370e+26 5 : 22456
## NA's :6 NA's: 53
## intro preg_num deliv_num preterm_num
## Min. :0.0000 Min. :0.000 Min. :0.0000 Min. :0.0000
## 1st Qu.:0.0000 1st Qu.:0.000 1st Qu.:0.0000 1st Qu.:0.0000
## Median :1.0000 Median :1.000 Median :0.0000 Median :0.0000
## Mean :0.7047 Mean :1.327 Mean :0.6733 Mean :0.0285
## 3rd Qu.:1.0000 3rd Qu.:2.000 3rd Qu.:1.0000 3rd Qu.:0.0000
## Max. :1.0000 Max. :9.000 Max. :9.0000 Max. :9.0000
##
## cs_num abortion_num ka_num height
## Min. :0.0000 Min. :0.0000 Min. :0.0000 Min. : 0.0
## 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:153.0
## Median :0.0000 Median :0.0000 Median :0.0000 Median :158.0
## Mean :0.1239 Mean :0.2432 Mean :0.1419 Mean :143.6
## 3rd Qu.:0.0000 3rd Qu.:0.0000 3rd Qu.:0.0000 3rd Qu.:162.0
## Max. :9.0000 Max. :9.0000 Max. :9.0000 Max. :197.0
##
## pre_weight final_weight pre_smoke smoke
## Min. :0 Min. : 0.00 0 :475818 0 :548416
## 1st Qu.:0 1st Qu.: 50.00 2 : 66063 1 : 29410
## Median :0 Median : 59.30 1 : 40450 2 : 10473
## Mean :0 Mean : 49.95 3 : 0 4 : 0
## 3rd Qu.:0 3rd Qu.: 66.25 4 : 0 5 : 0
## Max. :0 Max. :149.90 (Other): 0 (Other): 0
## NA's :139631 NA's :133663
## alcohol partn_smoke partn_alco delivery_date
## Min. :0.0000 Min. :0.0000 Min. :0.0000 Length:721962
## 1st Qu.:1.0000 1st Qu.:0.0000 1st Qu.:0.0000 Class :character
## Median :1.0000 Median :0.0000 Median :0.0000 Mode :character
## Mean :0.8253 Mean :0.3052 Mean :0.1831
## 3rd Qu.:1.0000 3rd Qu.:0.0000 3rd Qu.:0.0000
## Max. :3.0000 Max. :2.0000 Max. :1.0000
##
## deliv_week deliv_day age mode_deliv
## Min. : 0.00 Min. :0.000 Min. : 0.00 Min. :0.000
## 1st Qu.:37.00 1st Qu.:1.000 1st Qu.:29.00 1st Qu.:1.000
## Median :38.00 Median :3.000 Median :33.00 Median :1.000
## Mean :38.06 Mean :2.898 Mean :32.39 Mean :1.728
## 3rd Qu.:40.00 3rd Qu.:5.000 3rd Qu.:36.00 3rd Qu.:2.000
## Max. :45.00 Max. :6.000 Max. :49.85 Max. :5.000
##
## tolac bleeding induction dilation
## Min. :0.000000 Min. : 0.0 Length:721962 Min. :0.00000
## 1st Qu.:0.000000 1st Qu.: 270.0 Class :character 1st Qu.:0.00000
## Median :0.000000 Median : 470.0 Mode :character Median :0.00000
## Mean :0.004056 Mean : 614.2 Mean :0.07601
## 3rd Qu.:0.000000 3rd Qu.: 793.0 3rd Qu.:0.00000
## Max. :1.000000 Max. :17522.0 Max. :1.00000
##
## nst variablity nst_pattern nrfs
## 0 : 15329 Min. :0.0000 2 : 93016 Min. :0.000
## 1 :183389 1st Qu.:0.0000 3 : 62114 1st Qu.:0.000
## 2 :107551 Median :1.0000 5 : 29100 Median :0.000
## 3 : 94534 Mean :0.6266 1 : 28736 Mean :0.171
## 4 : 42572 3rd Qu.:1.0000 8 : 15138 3rd Qu.:0.000
## 5 : 3088 Max. :2.0000 (Other): 31271 Max. :2.000
## NA's:275499 NA's :462587
## complication th_abortion th_abort_bleeding ur_infection
## Min. :0.0000 Min. :0.0000 Min. :0.00000 Min. :0.000000
## 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:0.00000 1st Qu.:0.000000
## Median :1.0000 Median :0.0000 Median :0.00000 Median :0.000000
## Mean :0.6427 Mean :0.0695 Mean :0.01418 Mean :0.001025
## 3rd Qu.:1.0000 3rd Qu.:0.0000 3rd Qu.:0.00000 3rd Qu.:0.000000
## Max. :1.0000 Max. :2.0000 Max. :1.00000 Max. :1.000000
##
## periodontitis hyperemesis anemia th_preterm
## Min. :0.00000 Min. :0.00000 Min. :0.000 Min. :0.0000
## 1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.000 1st Qu.:0.0000
## Median :0.00000 Median :0.00000 Median :0.000 Median :0.0000
## Mean :0.00138 Mean :0.01019 Mean :0.122 Mean :0.1857
## 3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.000 3rd Qu.:0.0000
## Max. :1.00000 Max. :1.00000 Max. :1.000 Max. :1.0000
##
## asthenia short_cl prolapsed cerclage
## Min. :0.000000 Min. :0.00000 Min. :0.000000 Min. :0.00000
## 1st Qu.:0.000000 1st Qu.:0.00000 1st Qu.:0.000000 1st Qu.:0.00000
## Median :0.000000 Median :0.00000 Median :0.000000 Median :0.00000
## Mean :0.009506 Mean :0.04773 Mean :0.003759 Mean :0.01004
## 3rd Qu.:0.000000 3rd Qu.:0.00000 3rd Qu.:0.000000 3rd Qu.:0.00000
## Max. :1.000000 Max. :1.00000 Max. :1.000000 Max. :1.00000
##
## abruption hdp hdp_eo hdp_lo
## Min. :0.000000 Length:721962 Min. :0.000000 Min. :0.00000
## 1st Qu.:0.000000 Class :character 1st Qu.:0.000000 1st Qu.:0.00000
## Median :0.000000 Mode :character Median :0.000000 Median :0.00000
## Mean :0.009244 Mean :0.006745 Mean :0.03277
## 3rd Qu.:0.000000 3rd Qu.:0.000000 3rd Qu.:0.00000
## Max. :1.000000 Max. :1.000000 Max. :1.00000
##
## hdp_S hdp_H hdp_h hdp_P
## Min. :0.00000 Min. :0.00000 Min. :0.00000 Min. :0.00000
## 1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.00000
## Median :0.00000 Median :0.00000 Median :0.00000 Median :0.00000
## Mean :0.00195 Mean :0.04462 Mean :0.02053 Mean :0.02118
## 3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.00000
## Max. :1.00000 Max. :2.00000 Max. :1.00000 Max. :2.00000
##
## hdp_p pprom pprom_week fgr
## Min. :0.00000 Min. :0.0000 Min. :10.0 Length:721962
## 1st Qu.:0.00000 1st Qu.:0.0000 1st Qu.:36.0 Class :character
## Median :0.00000 Median :0.0000 Median :38.0 Mode :character
## Mean :0.02918 Mean :0.1249 Mean :36.8
## 3rd Qu.:0.00000 3rd Qu.:0.0000 3rd Qu.:39.0
## Max. :2.00000 Max. :1.0000 Max. :41.4
## NA's :638654
## gdm obert_dm previa low_lying
## Min. :0.00000 Min. :0.000000 Min. :0.00000 Min. :0.000000
## 1st Qu.:0.00000 1st Qu.:0.000000 1st Qu.:0.00000 1st Qu.:0.000000
## Median :0.00000 Median :0.000000 Median :0.00000 Median :0.000000
## Mean :0.06662 Mean :0.008434 Mean :0.01428 Mean :0.009194
## 3rd Qu.:0.00000 3rd Qu.:0.000000 3rd Qu.:0.00000 3rd Qu.:0.000000
## Max. :1.00000 Max. :1.000000 Max. :1.00000 Max. :1.000000
##
## blood_type cam oligo_hyd poly_hyd
## Min. :0.000000 Min. :0.000000 Min. :0.000000 Min. :0.00000
## 1st Qu.:0.000000 1st Qu.:0.000000 1st Qu.:0.000000 1st Qu.:0.00000
## Median :0.000000 Median :0.000000 Median :0.000000 Median :0.00000
## Mean :0.007813 Mean :0.008061 Mean :0.006491 Mean :0.01659
## 3rd Qu.:0.000000 3rd Qu.:0.000000 3rd Qu.:0.000000 3rd Qu.:0.00000
## Max. :1.000000 Max. :1.000000 Max. :1.000000 Max. :1.00000
##
## eclampsia cerebral_hemo pulmo_edema
## Min. :0.0000000 Min. :0.0000000 Min. :0.0000000
## 1st Qu.:0.0000000 1st Qu.:0.0000000 1st Qu.:0.0000000
## Median :0.0000000 Median :0.0000000 Median :0.0000000
## Mean :0.0006856 Mean :0.0001025 Mean :0.0006455
## 3rd Qu.:0.0000000 3rd Qu.:0.0000000 3rd Qu.:0.0000000
## Max. :1.0000000 Max. :1.0000000 Max. :1.0000000
##
## fatty_liver hellp dic dic_score
## Min. :0.0000000 Min. :0.000000 Min. :0.000000 Min. : 1
## 1st Qu.:0.0000000 1st Qu.:0.000000 1st Qu.:0.000000 1st Qu.: 8
## Median :0.0000000 Median :0.000000 Median :0.000000 Median : 9
## Mean :0.0001731 Mean :0.001564 Mean :0.001713 Mean :10
## 3rd Qu.:0.0000000 3rd Qu.:0.000000 3rd Qu.:0.000000 3rd Qu.:13
## Max. :1.0000000 Max. :1.000000 Max. :1.000000 Max. :28
## NA's :721408
## death multiple_preg birth_weight newborn_death
## Min. :0.00e+00 Min. :0.00000 Min. : 250 Min. :0.000000
## 1st Qu.:0.00e+00 1st Qu.:0.00000 1st Qu.:2618 1st Qu.:0.000000
## Median :0.00e+00 Median :0.00000 Median :2932 Median :0.000000
## Mean :8.03e-05 Mean :0.06274 Mean :2868 Mean :0.007528
## 3rd Qu.:0.00e+00 3rd Qu.:0.00000 3rd Qu.:3216 3rd Qu.:0.000000
## Max. :1.00e+00 Max. :1.00000 Max. :4998 Max. :1.000000
## NA's :786
## maternal_hist bleeding_hist th_ab_hist th_contract_hist
## Min. :0.000 Min. :0.000000 Min. :0.000000 Min. :0.00000
## 1st Qu.:0.000 1st Qu.:0.000000 1st Qu.:0.000000 1st Qu.:0.00000
## Median :0.000 Median :0.000000 Median :0.000000 Median :0.00000
## Mean :0.145 Mean :0.001512 Mean :0.006919 Mean :0.02569
## 3rd Qu.:0.000 3rd Qu.:0.000000 3rd Qu.:0.000000 3rd Qu.:0.00000
## Max. :1.000 Max. :1.000000 Max. :1.000000 Max. :1.00000
##
## th_preterm_hist asthenia_hist laceration_hist leep_hist
## Min. :0.00000 Min. :0.000000 Min. :0.0000000 Min. :0.000000
## 1st Qu.:0.00000 1st Qu.:0.000000 1st Qu.:0.0000000 1st Qu.:0.000000
## Median :0.00000 Median :0.000000 Median :0.0000000 Median :0.000000
## Mean :0.01479 Mean :0.003618 Mean :0.0007521 Mean :0.001092
## 3rd Qu.:0.00000 3rd Qu.:0.000000 3rd Qu.:0.0000000 3rd Qu.:0.000000
## Max. :1.00000 Max. :1.000000 Max. :1.0000000 Max. :1.000000
##
## conization_hist hdp_hist preeclampsia_hist abruption_hist
## Min. :0.000000 Min. :0.00000 Min. :0.000000 Min. :0.00000
## 1st Qu.:0.000000 1st Qu.:0.00000 1st Qu.:0.000000 1st Qu.:0.00000
## Median :0.000000 Median :0.00000 Median :0.000000 Median :0.00000
## Mean :0.004065 Mean :0.01644 Mean :0.004824 Mean :0.00401
## 3rd Qu.:0.000000 3rd Qu.:0.00000 3rd Qu.:0.000000 3rd Qu.:0.00000
## Max. :1.000000 Max. :1.00000 Max. :1.000000 Max. :1.00000
##
## previa_hist pprom_hist infection_hist stillbirth_hist
## Min. :0.000000 Min. :0.000000 Min. :0.000000 Min. :0.000000
## 1st Qu.:0.000000 1st Qu.:0.000000 1st Qu.:0.000000 1st Qu.:0.000000
## Median :0.000000 Median :0.000000 Median :0.000000 Median :0.000000
## Mean :0.003054 Mean :0.008549 Mean :0.001342 Mean :0.009416
## 3rd Qu.:0.000000 3rd Qu.:0.000000 3rd Qu.:0.000000 3rd Qu.:0.000000
## Max. :1.000000 Max. :1.000000 Max. :1.000000 Max. :1.000000
##
## fgr_hist gdm_hist maternal_chronic nerve_chronic
## Min. :0.000000 Min. :0.0000000 Min. :0.0000 Min. :0.0
## 1st Qu.:0.000000 1st Qu.:0.0000000 1st Qu.:0.0000 1st Qu.:1.0
## Median :0.000000 Median :0.0000000 Median :0.0000 Median :1.0
## Mean :0.008686 Mean :0.0002438 Mean :0.3522 Mean :0.9
## 3rd Qu.:0.000000 3rd Qu.:0.0000000 3rd Qu.:1.0000 3rd Qu.:1.0
## Max. :1.000000 Max. :1.0000000 Max. :1.0000 Max. :1.0
## NA's :712617
## resp_chronic intes_chronic appe_chronic gastro_chronic
## Min. :0 Min. :0.0 Min. :0 Min. :0
## 1st Qu.:1 1st Qu.:1.0 1st Qu.:1 1st Qu.:1
## Median :1 Median :1.0 Median :1 Median :1
## Mean :1 Mean :0.9 Mean :1 Mean :1
## 3rd Qu.:1 3rd Qu.:1.0 3rd Qu.:1 3rd Qu.:1
## Max. :1 Max. :1.0 Max. :1 Max. :1
## NA's :700367 NA's :712586 NA's :719428 NA's :720306
## hepa_chronic nephrology_chronic nephritis_chronic pyelo_chronic
## Min. :0.0 Min. :0.0 Min. :0.000000 Min. :0.000000
## 1st Qu.:1.0 1st Qu.:1.0 1st Qu.:0.000000 1st Qu.:0.000000
## Median :1.0 Median :1.0 Median :0.000000 Median :0.000000
## Mean :0.8 Mean :0.9 Mean :0.002564 Mean :0.002211
## 3rd Qu.:1.0 3rd Qu.:1.0 3rd Qu.:0.000000 3rd Qu.:0.000000
## Max. :1.0 Max. :1.0 Max. :1.000000 Max. :1.000000
## NA's :718477 NA's :713388
## cystitis_chronic hemato_chronic cardio_chronic thyroid_chronic
## Min. :0.0000000 Min. :0.000000 Min. :0.00000 Min. :0.00000
## 1st Qu.:0.0000000 1st Qu.:0.000000 1st Qu.:0.00000 1st Qu.:0.00000
## Median :0.0000000 Median :0.000000 Median :0.00000 Median :0.00000
## Mean :0.0009696 Mean :0.008176 Mean :0.01253 Mean :0.03957
## 3rd Qu.:0.0000000 3rd Qu.:0.000000 3rd Qu.:0.00000 3rd Qu.:0.00000
## Max. :1.0000000 Max. :1.000000 Max. :1.00000 Max. :1.00000
##
## hyperthyro_chronic hypothyro_chronic hasimoto_chronic skeleton_chronic
## Min. :0.00000 Min. :0.00000 Min. :0.000000 Min. :0.000000
## 1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.000000 1st Qu.:0.000000
## Median :0.00000 Median :0.00000 Median :0.000000 Median :0.000000
## Mean :0.01078 Mean :0.01765 Mean :0.008293 Mean :0.004254
## 3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.000000 3rd Qu.:0.000000
## Max. :1.00000 Max. :1.00000 Max. :1.000000 Max. :1.000000
##
## muscle_chronic utanomaly_chronic myoma_chronic adnexa_chronic
## Min. :0.0000000 Min. :0.000000 Min. :0.00000 Min. :0.00000
## 1st Qu.:0.0000000 1st Qu.:0.000000 1st Qu.:0.00000 1st Qu.:0.00000
## Median :0.0000000 Median :0.000000 Median :0.00000 Median :0.00000
## Mean :0.0007674 Mean :0.004139 Mean :0.05231 Mean :0.02446
## 3rd Qu.:0.0000000 3rd Qu.:0.000000 3rd Qu.:0.00000 3rd Qu.:0.00000
## Max. :1.0000000 Max. :1.000000 Max. :1.00000 Max. :1.00000
##
## trauma_chronic mental_chronic autoimmune_chronic hypertension_chronic
## Min. :0.0000000 Min. :0.00000 Min. :0.000000 Min. :0.000000
## 1st Qu.:0.0000000 1st Qu.:0.00000 1st Qu.:0.000000 1st Qu.:0.000000
## Median :0.0000000 Median :0.00000 Median :0.000000 Median :0.000000
## Mean :0.0005208 Mean :0.02956 Mean :0.008651 Mean :0.008833
## 3rd Qu.:0.0000000 3rd Qu.:0.00000 3rd Qu.:0.000000 3rd Qu.:0.000000
## Max. :1.0000000 Max. :1.00000 Max. :1.000000 Max. :1.000000
##
## infection gbs chlamydia syphilis
## Min. :0.0000 Min. :0.0000 Min. :0.00000 Min. :0.000000
## 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:0.00000 1st Qu.:0.000000
## Median :0.0000 Median :0.0000 Median :0.00000 Median :0.000000
## Mean :0.1644 Mean :0.1107 Mean :0.01059 Mean :0.001083
## 3rd Qu.:0.0000 3rd Qu.:0.0000 3rd Qu.:0.00000 3rd Qu.:0.000000
## Max. :1.0000 Max. :1.0000 Max. :1.00000 Max. :1.000000
##
## hbs hcv rubella toxoplasma
## Min. :0.000000 Min. :0.000000 Min. :0.000000 Min. :0.000000
## 1st Qu.:0.000000 1st Qu.:0.000000 1st Qu.:0.000000 1st Qu.:0.000000
## Median :0.000000 Median :0.000000 Median :0.000000 Median :0.000000
## Mean :0.003441 Mean :0.002033 Mean :0.004324 Mean :0.001995
## 3rd Qu.:0.000000 3rd Qu.:0.000000 3rd Qu.:0.000000 3rd Qu.:0.000000
## Max. :1.000000 Max. :1.000000 Max. :1.000000 Max. :1.000000
##
## cmv htlv_1 hiv parvo
## Min. :0.000000 Min. :0.000000 Min. :0.0000000 Min. :0.0000000
## 1st Qu.:0.000000 1st Qu.:0.000000 1st Qu.:0.0000000 1st Qu.:0.0000000
## Median :0.000000 Median :0.000000 Median :0.0000000 Median :0.0000000
## Mean :0.001409 Mean :0.001927 Mean :0.0001399 Mean :0.0005097
## 3rd Qu.:0.000000 3rd Qu.:0.000000 3rd Qu.:0.0000000 3rd Qu.:0.0000000
## Max. :1.000000 Max. :1.000000 Max. :1.0000000 Max. :1.0000000
##
## vaginitis influ medication steroid
## Min. :0.000000 Min. :0.000000 Min. :0.0000 Min. :0.0000
## 1st Qu.:0.000000 1st Qu.:0.000000 1st Qu.:0.0000 1st Qu.:0.0000
## Median :0.000000 Median :0.000000 Median :0.0000 Median :0.0000
## Mean :0.009851 Mean :0.004097 Mean :0.4914 Mean :0.0314
## 3rd Qu.:0.000000 3rd Qu.:0.000000 3rd Qu.:1.0000 3rd Qu.:0.0000
## Max. :1.000000 Max. :1.000000 Max. :1.0000 Max. :1.0000
##
## throid_med antibio_med_ven antibio_med_int antibio_med_vag
## Min. :0.00000 Min. :0.0000 Min. :0.00000 Min. :0.00000
## 1st Qu.:0.00000 1st Qu.:0.0000 1st Qu.:0.00000 1st Qu.:0.00000
## Median :0.00000 Median :0.0000 Median :0.00000 Median :0.00000
## Mean :0.02067 Mean :0.1801 Mean :0.07854 Mean :0.03378
## 3rd Qu.:0.00000 3rd Qu.:0.0000 3rd Qu.:0.00000 3rd Qu.:0.00000
## Max. :1.00000 Max. :1.0000 Max. :1.00000 Max. :1.00000
##
## ritodrine_med insulin_med mg_med aspirin_med
## Length:721962 Min. :0.00000 Min. :0.0000 Min. :0.00000
## Class :character 1st Qu.:0.00000 1st Qu.:0.0000 1st Qu.:0.00000
## Mode :character Median :0.00000 Median :0.0000 Median :0.00000
## Mean :0.02456 Mean :0.0419 Mean :0.01299
## 3rd Qu.:0.00000 3rd Qu.:0.0000 3rd Qu.:0.00000
## Max. :1.00000 Max. :1.0000 Max. :1.00000
##
## heparin_med psycho_med cablocker_med art_new
## Min. :0.00000 Min. :0.00000 Min. :0.00000 Min. :0.000
## 1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:0.00000 1st Qu.:1.000
## Median :0.00000 Median :0.00000 Median :0.00000 Median :1.000
## Mean :0.01397 Mean :0.01023 Mean :0.02115 Mean :1.207
## 3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:0.00000 3rd Qu.:1.000
## Max. :1.00000 Max. :1.00000 Max. :1.00000 Max. :3.000
##
## primipara pre_smoking smoking
## Min. :0.0000 Min. :0.0000 Min. :0.00000
## 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:0.00000
## Median :0.0000 Median :0.0000 Median :0.00000
## Mean :0.4845 Mean :0.1483 Mean :0.05525
## 3rd Qu.:1.0000 3rd Qu.:0.0000 3rd Qu.:0.00000
## Max. :1.0000 Max. :1.0000 Max. :1.00000
##
#0-8 尺度を変換
df[c("art", "intro","pre_smoke","smoke", "alcohol",
"partn_smoke", "partn_alco", "mode_deliv", "tolac",
"induction","dilation","nst","variablity","nst_pattern",
"nrfs", "complication", "th_abortion", "th_abort_bleeding",
"ur_infection", "periodontitis", "hyperemesis", "anemia",
"th_preterm", "asthenia", "short_cl", "prolapsed",
"cerclage", "abruption", "hdp","hdp_eo","hdp_lo",
"hdp_S","hdp_H","hdp_h","hdp_P","hdp_p","pprom",
"fgr","gdm","obert_dm","previa","low_lying","blood_type",
"cam","oligo_hyd","poly_hyd","eclampsia","cerebral_hemo",
"pulmo_edema","fatty_liver","hellp","dic","death",
"multiple_preg","newborn_death","maternal_hist",
"bleeding_hist","th_ab_hist","th_contract_hist",
"th_preterm_hist","asthenia_hist","laceration_hist",
"leep_hist","conization_hist","hdp_hist","preeclampsia_hist",
"abruption_hist","previa_hist","pprom_hist","infection_hist",
"stillbirth_hist","fgr_hist","gdm_hist","maternal_chronic",
"nerve_chronic","resp_chronic","intes_chronic","appe_chronic",
"gastro_chronic","hepa_chronic","nephrology_chronic","nephritis_chronic",
"pyelo_chronic","cystitis_chronic","hemato_chronic","cardio_chronic",
"thyroid_chronic","hyperthyro_chronic","hypothyro_chronic","hasimoto_chronic",
"skeleton_chronic","muscle_chronic","utanomaly_chronic","myoma_chronic",
"adnexa_chronic","trauma_chronic","mental_chronic","autoimmune_chronic",
"hypertension_chronic","infection","gbs","chlamydia","syphilis","hbs",
"hcv","rubella","toxoplasma","cmv","htlv_1","hiv","parvo","vaginitis",
"influ","medication","steroid","throid_med","antibio_med_ven","antibio_med_int",
"antibio_med_vag","ritodrine_med","insulin_med","mg_med","aspirin_med",
"heparin_med","psycho_med","cablocker_med","art_new","primipara", "pre_smoking", "smoking")]<-
lapply(df[c("art", "intro","pre_smoke","smoke", "alcohol",
"partn_smoke", "partn_alco", "mode_deliv", "tolac",
"induction","dilation","nst","variablity","nst_pattern",
"nrfs", "complication", "th_abortion", "th_abort_bleeding",
"ur_infection", "periodontitis", "hyperemesis", "anemia",
"th_preterm", "asthenia", "short_cl", "prolapsed",
"cerclage", "abruption", "hdp","hdp_eo","hdp_lo",
"hdp_S","hdp_H","hdp_h","hdp_P","hdp_p","pprom",
"fgr","gdm","obert_dm","previa","low_lying","blood_type",
"cam","oligo_hyd","poly_hyd","eclampsia","cerebral_hemo",
"pulmo_edema","fatty_liver","hellp","dic","death",
"multiple_preg","newborn_death","maternal_hist",
"bleeding_hist","th_ab_hist","th_contract_hist",
"th_preterm_hist","asthenia_hist","laceration_hist",
"leep_hist","conization_hist","hdp_hist","preeclampsia_hist",
"abruption_hist","previa_hist","pprom_hist","infection_hist",
"stillbirth_hist","fgr_hist","gdm_hist","maternal_chronic",
"nerve_chronic","resp_chronic","intes_chronic","appe_chronic",
"gastro_chronic","hepa_chronic","nephrology_chronic","nephritis_chronic",
"pyelo_chronic","cystitis_chronic","hemato_chronic","cardio_chronic",
"thyroid_chronic","hyperthyro_chronic","hypothyro_chronic","hasimoto_chronic",
"skeleton_chronic","muscle_chronic","utanomaly_chronic","myoma_chronic",
"adnexa_chronic","trauma_chronic","mental_chronic","autoimmune_chronic",
"hypertension_chronic","infection","gbs","chlamydia","syphilis","hbs",
"hcv","rubella","toxoplasma","cmv","htlv_1","hiv","parvo","vaginitis",
"influ","medication","steroid","throid_med","antibio_med_ven","antibio_med_int",
"antibio_med_vag","ritodrine_med","insulin_med","mg_med","aspirin_med",
"heparin_med","psycho_med","cablocker_med","art_new","primipara", "pre_smoking", "smoking")], as.factor)
summary(df)
## year location serial_num art intro
## Min. :2016 Min. : 1.0 Min. :0.000e+00 0 :607076 0:213172
## 1st Qu.:2016 1st Qu.:101.0 1st Qu.:2.130e+02 1 : 17803 1:508790
## Median :2017 Median :177.0 Median :5.070e+02 2 : 15110
## Mean :2017 Mean :189.4 Mean :1.898e+20 3 : 45508
## 3rd Qu.:2018 3rd Qu.:283.0 3rd Qu.:1.585e+03 4 : 13956
## Max. :2018 Max. :401.0 Max. :1.370e+26 5 : 22456
## NA's :6 NA's: 53
## preg_num deliv_num preterm_num cs_num
## Min. :0.000 Min. :0.0000 Min. :0.0000 Min. :0.0000
## 1st Qu.:0.000 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:0.0000
## Median :1.000 Median :0.0000 Median :0.0000 Median :0.0000
## Mean :1.327 Mean :0.6733 Mean :0.0285 Mean :0.1239
## 3rd Qu.:2.000 3rd Qu.:1.0000 3rd Qu.:0.0000 3rd Qu.:0.0000
## Max. :9.000 Max. :9.0000 Max. :9.0000 Max. :9.0000
##
## abortion_num ka_num height pre_weight
## Min. :0.0000 Min. :0.0000 Min. : 0.0 Min. :0
## 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:153.0 1st Qu.:0
## Median :0.0000 Median :0.0000 Median :158.0 Median :0
## Mean :0.2432 Mean :0.1419 Mean :143.6 Mean :0
## 3rd Qu.:0.0000 3rd Qu.:0.0000 3rd Qu.:162.0 3rd Qu.:0
## Max. :9.0000 Max. :9.0000 Max. :197.0 Max. :0
##
## final_weight pre_smoke smoke alcohol partn_smoke
## Min. : 0.00 0 :475818 0 :548416 0:168719 0:605344
## 1st Qu.: 50.00 2 : 66063 1 : 29410 1:515780 1: 12914
## Median : 59.30 1 : 40450 2 : 10473 2: 32308 2:103704
## Mean : 49.95 3 : 0 4 : 0 3: 5155
## 3rd Qu.: 66.25 4 : 0 5 : 0
## Max. :149.90 (Other): 0 (Other): 0
## NA's :139631 NA's :133663
## partn_alco delivery_date deliv_week deliv_day age
## 0:589766 Length:721962 Min. : 0.00 Min. :0.000 Min. : 0.00
## 1:132196 Class :character 1st Qu.:37.00 1st Qu.:1.000 1st Qu.:29.00
## Mode :character Median :38.00 Median :3.000 Median :33.00
## Mean :38.06 Mean :2.898 Mean :32.39
## 3rd Qu.:40.00 3rd Qu.:5.000 3rd Qu.:36.00
## Max. :45.00 Max. :6.000 Max. :49.85
##
## mode_deliv tolac bleeding induction dilation nst
## 0: 4159 0:719034 Min. : 0.0 0:535933 0:667087 0 : 15329
## 1:418725 1: 2928 1st Qu.: 270.0 1:186029 1: 54875 1 :183389
## 2:131721 Median : 470.0 2 :107551
## 3:112122 Mean : 614.2 3 : 94534
## 4: 46813 3rd Qu.: 793.0 4 : 42572
## 5: 8422 Max. :17522.0 5 : 3088
## NA's:275499
## variablity nst_pattern nrfs complication th_abortion
## 0:280124 2 : 93016 0:657031 0:257946 0:696438
## 1:431328 3 : 62114 1: 6375 1:464016 1: 871
## 2: 10510 5 : 29100 2: 58556 2: 24653
## 1 : 28736
## 8 : 15138
## (Other): 31271
## NA's :462587
## th_abort_bleeding ur_infection periodontitis hyperemesis anemia th_preterm
## 0:711726 0:721222 0:720966 0:714607 0:633893 0:587924
## 1: 10236 1: 740 1: 996 1: 7355 1: 88069 1:134038
##
##
##
##
##
## asthenia short_cl prolapsed cerclage abruption hdp hdp_eo
## 0:715099 0:687505 0:719248 0:714710 0:715288 0:679263 0:717092
## 1: 6863 1: 34457 1: 2714 1: 7252 1: 6674 1: 42699 1: 4870
##
##
##
##
##
## hdp_lo hdp_S hdp_H hdp_h hdp_P hdp_p pprom
## 0:698304 0:720554 0:705537 0:707142 0:713978 0:711091 0:631821
## 1: 23658 1: 1408 1: 637 1: 14820 1: 678 1: 673 1: 90141
## 2: 15788 2: 7306 2: 10198
##
##
##
##
## pprom_week fgr gdm obert_dm previa low_lying
## Min. :10.0 0:693694 0:673865 0:715873 0:711651 0:715324
## 1st Qu.:36.0 1: 28268 1: 48097 1: 6089 1: 10311 1: 6638
## Median :38.0
## Mean :36.8
## 3rd Qu.:39.0
## Max. :41.4
## NA's :638654
## blood_type cam oligo_hyd poly_hyd eclampsia cerebral_hemo
## 0:716321 0:716142 0:717276 0:709983 0:721467 0:721888
## 1: 5641 1: 5820 1: 4686 1: 11979 1: 495 1: 74
##
##
##
##
##
## pulmo_edema fatty_liver hellp dic dic_score death
## 0:721496 0:721837 0:720833 0:720725 Min. : 1 0:721904
## 1: 466 1: 125 1: 1129 1: 1237 1st Qu.: 8 1: 58
## Median : 9
## Mean :10
## 3rd Qu.:13
## Max. :28
## NA's :721408
## multiple_preg birth_weight newborn_death maternal_hist bleeding_hist
## 0:676665 Min. : 250 0:716527 0:617275 0:720870
## 1: 45297 1st Qu.:2618 1: 5435 1:104687 1: 1092
## Median :2932
## Mean :2868
## 3rd Qu.:3216
## Max. :4998
## NA's :786
## th_ab_hist th_contract_hist th_preterm_hist asthenia_hist laceration_hist
## 0:716967 0:703415 0:711282 0:719350 0:721419
## 1: 4995 1: 18547 1: 10680 1: 2612 1: 543
##
##
##
##
##
## leep_hist conization_hist hdp_hist preeclampsia_hist abruption_hist
## 0:721174 0:719027 0:710092 0:718479 0:719067
## 1: 788 1: 2935 1: 11870 1: 3483 1: 2895
##
##
##
##
##
## previa_hist pprom_hist infection_hist stillbirth_hist fgr_hist gdm_hist
## 0:719757 0:715790 0:720993 0:715164 0:715691 0:721786
## 1: 2205 1: 6172 1: 969 1: 6798 1: 6271 1: 176
##
##
##
##
##
## maternal_chronic nerve_chronic resp_chronic intes_chronic appe_chronic
## 0:467653 0 : 752 0 : 618 0 : 700 0 : 24
## 1:254309 1 : 8593 1 : 20977 1 : 8676 1 : 2510
## NA's:712617 NA's:700367 NA's:712586 NA's:719428
##
##
##
##
## gastro_chronic hepa_chronic nephrology_chronic nephritis_chronic
## 0 : 54 0 : 748 0 : 1244 0:720111
## 1 : 1602 1 : 2737 1 : 7330 1: 1851
## NA's:720306 NA's:718477 NA's:713388
##
##
##
##
## pyelo_chronic cystitis_chronic hemato_chronic cardio_chronic thyroid_chronic
## 0:720366 0:721262 0:716059 0:712918 0:693395
## 1: 1596 1: 700 1: 5903 1: 9044 1: 28567
##
##
##
##
##
## hyperthyro_chronic hypothyro_chronic hasimoto_chronic skeleton_chronic
## 0:714180 0:709220 0:715975 0:718891
## 1: 7782 1: 12742 1: 5987 1: 3071
##
##
##
##
##
## muscle_chronic utanomaly_chronic myoma_chronic adnexa_chronic trauma_chronic
## 0:721408 0:718974 0:684199 0:704300 0:721586
## 1: 554 1: 2988 1: 37763 1: 17662 1: 376
##
##
##
##
##
## mental_chronic autoimmune_chronic hypertension_chronic infection gbs
## 0:700623 0:715716 0:715585 0:603284 0:642020
## 1: 21339 1: 6246 1: 6377 1:118678 1: 79942
##
##
##
##
##
## chlamydia syphilis hbs hcv rubella toxoplasma cmv
## 0:714319 0:721180 0:719478 0:720494 0:718840 0:720522 0:720945
## 1: 7643 1: 782 1: 2484 1: 1468 1: 3122 1: 1440 1: 1017
##
##
##
##
##
## htlv_1 hiv parvo vaginitis influ medication steroid
## 0:720571 0:721861 0:721594 0:714850 0:719004 0:367183 0:699291
## 1: 1391 1: 101 1: 368 1: 7112 1: 2958 1:354779 1: 22671
##
##
##
##
##
## throid_med antibio_med_ven antibio_med_int antibio_med_vag ritodrine_med
## 0:707036 0:591910 0:665262 0:697573 0:573668
## 1: 14926 1:130052 1: 56700 1: 24389 1:148294
##
##
##
##
##
## insulin_med mg_med aspirin_med heparin_med psycho_med cablocker_med
## 0:704230 0:691709 0:712584 0:711876 0:714575 0:706691
## 1: 17732 1: 30253 1: 9378 1: 10086 1: 7387 1: 15271
##
##
##
##
##
## art_new primipara pre_smoking smoking
## 0: 11041 0:372207 0:614931 0:682074
## 1:607076 1:349755 1:107031 1: 39888
## 2: 47330
## 3: 56515
##
##
##