프로그래밍 Programming
Data Preparation (12) - Clean (Remove Missing Target)
문장전달자
2014. 12. 5. 19:07
728x90
아래는 missing target 을 제거하는 작업이다.
> target
[1] "rain_tomorrow"
> ds[target]
rain_tomorrow
1 Yes
2 Yes
3 Yes
4 Yes
5 No
6 No
7 No
8 No
9 Yes
10 No
11 No
12 No
> is.na(ds[target])
rain_tomorrow
[1,] FALSE
[2,] FALSE
[3,] FALSE
[4,] FALSE
[5,] FALSE
[6,] FALSE
[7,] FALSE
[8,] FALSE
[9,] FALSE
[10,] FALSE
> sum(is.na(ds[target]))
[1] 0
> ds <- ds[!is.na(ds[target]),]
> sum(is.na(ds[target]))
[1] 0
> dim(ds) // 366 observations, 24 variables
[1] 366 24
>
728x90