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
'프로그래밍 Programming' 카테고리의 다른 글
Data Preparation (14) - Clean (Omitting Observations) (0) | 2014.12.06 |
---|---|
Data Preparation (13) - Clean (Deal with Missing Values) (0) | 2014.12.06 |
Data Preparation (11) - Clean (Feature Selection) (0) | 2014.12.05 |
Data Preparation (10) - Clean (Remove the Variables) (0) | 2014.12.05 |
lower.tri / upper.tri (0) | 2014.12.05 |