This file contains 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() | |
## 데이터 불러오기 | |
# csv파일을 일반적으로 불러올때 : read.csv("파일명") | |
csvGrocery<-read.csv("./BigData/grocery.csv") | |
csvGrocery | |
# 데이터 분석시 데이터를 확인 함수 : fix() | |
fix(csvGrocery) | |
This file contains 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() | |
# read.table() : 외부파일에서 데이터 프레임으로 값을 가져온다 | |
dfData <- read.table("./BigData/employee.txt") | |
dfData | |
# 데이터에서 열이름과 행이름이 지정된 경우에 해당하는 조건을 지정하여 생성 | |
# read.table(파일명, row.name='행구분 열이름', header=T|F) | |
dfData <- read.table("./BigData/employee.txt",row.names='no',header=T) | |
dfData | |
# 데이터프레임에서 각각의 정보를 선택할 때는 리스트와 동일 | |
dfData$name |
This file contains 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() | |
# 리스트 생성 : listData | |
listData <- list("홍길동",550000, T) | |
listData | |
v <- c(1:5) | |
m <- matrix(c(1:6), nrow=2) |
This file contains 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
setwd("D:/BigData/source") | |
getwd() | |
#전치 행렬 : 행과 열을 바꾼 행렬 | |
m <- matrix(c(1:9),nrow=3) | |
m | |
t(m) | |
m | |
# 하삼각행렬 : lower.tri() |
This file contains 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() | |
# 행렬(Matrix) : 행과 열로 구성된 데이터 형태 | |
# 행렬의 생성 | |
m <- matrix(c(1:9)) | |
# m 데이터의 형태를 출력 : Class(데이터) | |
class(m) | |
m | |
# 3행 3열의 행렬을 생성 | |
m <- matrix(c(1:9),nrow = 3, ncol = 3) |
This file contains 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
# 김농부는 이전 년도의 날씨정보를 기반으로 내일 비가 오는지 그렇지 않은지를 예측하고자 한다. | |
# | |
# 날씨가 비가 온 날은 1, 비가 오지 않은 날은 0의 값을 갖는 데이터가 있다고 가정하자. | |
# | |
# 이전 k년의 날씨 기록을 기반으로 내일의 날씨를 예측하는데 조건은 k년 중 반 이상 비가 왔을 때 비가 온다고 가정하자. | |
# | |
# 기상 데이터와 예측을 위한 k년을 입력받아 이때 오차율을 계산해보자. | |
# 예측값과 실제값을 비교하여 두 값의 차가 1일 경우 오류이며 오류의 평균을 오차율로 한다. | |
## 실제 프로세스 |
This file contains 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() | |
# setwd(D:\\BigData\\Source) | |
# | |
x<-c(1:10) | |
x | |
y <- seq(1,20,2) | |
y <- seq(1,by=2, length=10) | |
replace(x,2,8) # X 데이터 변경은 안되고 출력만 | |
x<-replace(x,2,8) #데이터 치환 |
This file contains 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
<script type="text/javascript"> | |
function addzero(n){ // 한자리가 되는 숫자에 "0"을 넣어주는 함수 | |
return n < 10 ? "0" + n: n; | |
} | |
function dateInput(n,m){ | |
$("#StartDate").val(""); // 우선 이미 들어가있는 값 초기화 | |
$("#EndDate").val(""); | |
var date = new Date(); |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Insert title here</title> | |
<script src="//code.jquery.com/jquery.min.js"></script> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(function() { | |
$('#endDate').change(function(e) { |
This file contains 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
UPDATE | |
tb_person p | |
SET | |
p.person_total_mileage = | |
(SELECT | |
SUM(mct.mileage_cate_price - m.mileage_use_price) | |
FROM | |
tb_mileage m | |
JOIN | |
tb_mileage_cate mct |