INTRO data.table Rstudio Console> install.packages("data.table") data.table 간결한 syntax로 grouping, ordering 등의 기능을 제공하는 data.frame의 확장 데이터 구조로 조작, 관리, 처리에 대해 알아보자 test_datatable.R rm(list=ls()) setwd = "~/Rcoding" library(data.table) DT = data.table(x=c('b','b','b','a','a'), v=rnorm(5)) print(DT) ## data.frame type data(cars) head(cars) ## data.table type CARS = data.table(cars) head(CARS) ## dat..
INTRO sqldf를 이용한 DB 조회 Rstudio Console> install.packages("sqldf") plyr을 이용한 데이터 처리 내장함수이며 데이터 분리, 결합 등 데이터 처리기능 제공 # 참고 : dplyr은 c++로 구현되어 속도가 빠르고 chaining(var >> calc1 >> calc2, 중간변수 없이 최종값 계산)을 사용할 수 있음. 설치 필요 Rstudio Console> install.packages("dplyr") sqldf test_sqldf.R rm(list=ls()) setwd = "~/Rcoding" ## sqldf library(sqldf) data(iris) sqldf("select * from iris") sqldf("select * from iris l..
INTRO reshape를 이용한 데이터 재정렬 Rstudio Console> install.packages("reshape") #참고 : reshape2는 reshape의 확장판 개념, 설치 오래걸림 Rstudio Console> install.packages("reshape2") reshape reshape 패키지는 melt, cast를 사용하여 데이터를 재구성하거나 밀집화된 데이터를 유연하게 생성해줌 melt 녹이다, cast 전 데이터 형태 추출 syntax : var = melt(data, id=) cast 굳히다, 원하는 형태로 데이터를 변형 syntax : var = melt(data, id=) a : 엑셀 피벗팅과 유사하게 자료 변환, 피벗테이블과는 다르게 구별된 순서가 부여됨 b : y축..

INTRO 1. scatter plot : 산점도 그래프, 산점도 행렬 2. histogram : 히스토그램, 막대그래프(bar chart) 3. box plot : 상자그림 1. scatter plot scatter plot x, y 변수 값을 평면에 점을 찍어 한눈에 볼 수 있도록 표현 test_plot_scatter.R ## scatter plot height = sample(x=150:180, size=20) weight = sample(x=50:90, size=20) plot(height, weight) 출력결과 scatter plot:matrix 다변수에 대해 상호간 산점도를 한눈에 볼 수 있도록 확장된 산점도 행렬 "main=" : 최상단 제목 "pch=" : 점 모양 "bg=" : 점 색상..

INTRO 1. paste, substr 2. as. : 객체변환 3. date, format 1. paste, substr paste 입력받은 문자를 하나로 붙여주며 "sep=" 옵션을 이용해 문자열들 사이에 구분자(separator) 사입 가능 substr 문자열에서 특정 문자열을 추출하는 기능 test_etc_fun.R rm(list=ls()) setwd = "~/Rcoding" ## paste number = 1:10 alphabet = c('a','b','c') paste(number,alphabet) paste(number,alphabet,sep=" to the ") ## substr substr("BigDataAnalysis", 1,4) contrys = c('Korea', 'Japan', ..

INTRO 1. 반복문 : iterational code block 2. 조건문 : conditional code block 3. 사용자 정의 함수 : costomized function 1. 반복문 for for (i in range) { print(i) } while x = 1 while ( x= 50) over50[i] = 1 else over50[i] = 0 } print(rand_a) print(over50) cat("count for results : ",sum(over50),"\n") 출력결과 > source("~/Rcoding/test_conditional_code_block.R", echo=TRUE) > rm(list = ls()) > # setwd("/Users/[YourMacID]/R..

INTRO 1. 벡터형 변수 2. 행렬/데이터프레임 test_indexing.R rm(list = ls()) setwd("/Users/[YourMacID]/Rcoding") a_chr = c('a', 'b', 'c', 'd', 'e') ## vector indexing a_chr[1] a_chr[-1] a_chr[c(2,4)] a_chr[1:3] ## dataframe indexing income = c(100,200,150,300,900) car = c('kia','hyundai','kia','toyota','lexus') marriage=c(FALSE,FALSE,FALSE,TRUE,TRUE) mydat = data.frame(income,car,marriage) print(mydat) mydat[3,..

INTRO 1. 수열 2. 수치계산 1. 수열 rep(arg1, arg2) : arg1을 arg2만큼 숫자 벡터 생성 arg1 : start number arg2 : repeat number seq(arg1, arg2) : arg1부터 arg2까지 1씩 증가하는 숫자 벡터 생성 arg1 : start number arg2 : end number seq(arg1, arg2, by=arg3) : arg1부터 arg2까지 arg3씩 증가하는 숫자 벡터 생성 arg1 : start number arg2 : end number by=arg3 : number of equal difference seq(arg1, arg2, length=arg3) : arg1부터 arg2까지 분할 숫자 arg3으로 숫자 벡터 생성 a..
- Total
- Today
- Yesterday
- Model
- server
- 라즈베리파이
- template
- r
- 자가격리
- 확진
- 코로나19
- sublime text
- SSH
- COVID-19
- arduino
- Raspberry Pi
- CSV
- DS18B20
- Python
- Django
- MacOS
- ERP
- raspberrypi
- analysis
- Regression
- github
- git
- vscode
- DAQ
- Pandas
- pyserial
- Templates
- 코로나
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |