DataScience
article thumbnail
728x90

 

basic1.csv
0.00MB

주어진 데이터에서 이상치(소수점 나이)를 찾고 올림, 내림, 버림(절사)했을때 3가지 모두 이상치 'age' 평균을 구한 다음 모두 더하여 출력하시오

library(dplyr)
df<-read.csv('../input/bigdatacertificationkr/basic1.csv')
df%>%filter((age*10)%%10!=0)%>%mutate(up=ceiling(age),low=floor(age),tr=trunc(age))
                    %>%summarise(mean1 = mean(up),mean2=mean(low), mean3=mean(tr))
                    %>%apply(1,sum)
                    
#정답:70

 

profile

DataScience

@Ninestar

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!