Created
July 27, 2017 02:48
-
-
Save enujo/9a979e1bbbfd1f8434f50050e7f9eba5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 현재 작업디렉토리 위치 확인 | |
getwd() | |
# 1일, 2일, 3일, 4일, 5일, 6일, 7일을 데이터로 갖는 벡터데이터 dateInfo 생성 | |
dateInfo <- c("1일","2일","3일","4일","5일","6일","7일") | |
# 07시, 12시, 17시 를 데이터로 갖는 벡터데이터 timeInfo 생성 | |
timeInfo <- c("07시","12시","17시") | |
# 20,19,20,22,23,18,20을 데이터로 갖는 벡터데이터 tempInfo07생성 | |
tempInfo07 <- c(20,19,20,22,23,18,20) | |
# 29,29,28,31,31,27,29를 데이터로 갖는 벡터데이터 tempInfo12생성 | |
tempInfo12 <- c(29,29,28,31,31,27,29) | |
# 21,17,22,24,21,19,20을 데이터로 갖는 벡터데이터 tempInfo17생성 | |
tempInfo17 <- c(21,17,22,24,21,19,20) | |
# tmpInfo07, tmpInfo12, tmpInfo17을 행 기준으로 연결하여 행렬 strData 생성 | |
strData <- rbind(tempInfo07, tempInfo12, tempInfo17) | |
strData | |
# 행의 이름으로 timeInfo, 열이름으로 dateInfo 값으로 strData 행렬이름 생성 | |
dimnames(strData) <- list(timeInfo , dateInfo) | |
strData | |
# 각 날짜별 평균 기온 구하기 | |
sumTemp <- apply(strData, 2, mean) | |
sumTemp | |
# 적산온도 : 평균 기온의 합 | |
sum(sumTemp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment