R complete.cases()

Jmnote (토론 | 기여)님의 2020년 4월 16일 (목) 23:35 판
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요

R complete.cases()
  • "Find Complete Cases"
df <- read.table( header=TRUE, stringsAsFactors=FALSE, text="
Class  Name English Math
    A Alice      90   60
    A   Bob      80   NA
    B Carol      NA   80
    B  Dave      60   90
")
complete.cases(df)
df <- read.table( header=TRUE, stringsAsFactors=FALSE, text="
Class  Name English Math
    A Alice      90   60
    A   Bob      80   NA
    B Carol      NA   80
    B  Dave      60   90
")
df <- df[complete.cases(df),]
df
df <- read.table( header=TRUE, stringsAsFactors=FALSE, text="
Class  Name English Math
    A Alice      90   60
    A   Bob      80   NA
    B Carol      NA   80
    B  Dave      60   90
")
library(dplyr, warn.conflicts = FALSE)
df <-  df %>% filter(complete.cases(df))
df

2 같이 보기

3 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}