x <- 7
y <- 5
x + y
## [1] 12
# 식으로 표현하기
cat(x,"+",y,"=",x+y)
## 7 + 5 = 12
plus <- function(x,y){
  return (cat(x,"+",y,"=",x+y));
}
plus(3,8)
## 3 + 8 = 11
minus <- function(x,y){
  return (cat(x,"-",y,"=",x-y));
}
minus(3,8)
## 3 - 8 = -5
multi <- function(x,y){
  return (cat(x,"*",y,"=",x*y));
}
multi(3,8)
## 3 * 8 = 24
div.float <- function(x,y){
  return (cat(x,"/",y,"=",x/y));
}
div.float(8,3)
## 8 / 3 = 2.666667
div.integer  <- function(x,y){
  return (cat(x,"%/%",y,"=",x%/%y));
}
div.integer(8,3)
## 8 %/% 3 = 2
div.remainder <- function(x,y){
  return (cat(x,"%%",y,"=",x%%y));
}
div.remainder(8,3)
## 8 %% 3 = 2
## 계산기 
x <-3
op <- "+"
y <- 2

calc <- function(x, op, y){
  switch(
    op,
    "+"=,plus(x,y),
    "-"=,plus(x,y),
    "*"=,plus(x,y),
    "/"=,plus(x,y),
    "%/%"=,plus(x,y),
    "%%"=,plus(x,y)
  )
  if(op=="+") plus(x,y) else
if(op=="-") minus(x,y) else
if(op=="*") multi(x,y) else
if(op=="/") div.float(x,y) else
if(op=="%/%") div.integer(x,y) else  
if(op=="%%") div.remainder(x,y) else
print("error")  
}
124p 자유자재로 데이터 가공하기

R언어의 기초2강, 2018.09.08 데이터 전처리-원하는 형태로 데이터 가공하기 주어진 데이터를 그대로 사용하기보다 원하는 형태로 변형해 분석하는 경우가 많습니다. 분석에 적합하게 데이터를 가공하는 작업을 데이터 전처리(Data preprocessing) dplyr함수를 이용해 데이터 가공을 합니다.

기술통계desc->객체에 대한 설명, 평균, 중간값, 최빈값 mean, median, mod->3M summary 통해서 뽑아냄. 추론통계 infer->