반응형
반응형
본문 바로가기

R programming44

R 기초; 반복 적용 - Apply Family R 기초; 반복 적용 - Apply Family apply() lapply() sapply() mapply() ?apply x 2021. 1. 16.
R 기초; 서브셋 R 기초; 서브셋 # 자동차 데이터 description str(mtcars) # mtcars 데이터의 mpg 열 데이터 불러오기 mtcars$mpg mtcars[["mpg"]] mtcars[[1]] [1] 21.0 21.0 22.8 21.4 18.7 18.1 14.3 24.4 22.8 19.2 17.8 [12] 16.4 17.3 15.2 10.4 10.4 14.7 32.4 30.4 33.9 21.5 15.5 [23] 15.2 13.3 19.2 27.3 26.0 30.4 15.8 19.7 15.0 21.4 # 데이터 프레임 형식으로 1열 4열 데이터 불러오기 mtcars[c(1, 4)] mpg hp Mazda RX4 21.0 110 Mazda RX4 Wag 21.0 110 Datsun 710 22.8 9.. 2021. 1. 16.
R 기초; 논리흐름 제어 R 기초; 논리흐름 제어 x 2021. 1. 16.
R 기초; 출력 R 기초; 출력 2021. 1. 15.
R 기초; 입력 R 기초; 입력 # 파일 읽기 read.csv(file="product.csv") # 도움말 보기 ?read.csv read.csv(file="product-with-no-header.csv", header=FALSE) read.table(file="product.txt") read.table(file="product.txt", header=TRUE) read.table(file="product-colon.txt", header=TRUE, sep=":") read.table(file="product-mssing.txt", header=TRUE) read.table(file="product-missing.txt", header=TRUE, na.strings=".") read.fwf(file= "produc.. 2021. 1. 15.
R 기초; 날짜와 시간 R 기초; 날짜와 시간 # 날짜 출력 Sys.Date() [1] "2021-01-15" # 날짜 + 시간 출력 date() [1] "Fri Jan 15 09:00:40 2021" # 날짜 + 시간 출력 Sys.time() [1] "2021-01-15 09:00:44 KST" class(Sys.Date()) [1] "Date" as.Date("2025-12-31") [1] "2025-12-31" as.Date("2025/12/31") [1] "2025-12-31" as.Date("12/31/2025") Error in charToDate(x) : 문자열이 표준서식을 따르지 않습니다 as.Date("12/31/2025", format("%m/%d/%y)) [1] "2020-12-31" # 도움말 보기 ?st.. 2021. 1. 15.
R 기초; 웹 스크레이핑 stringr 패키지 R 기초; 웹 스크레이핑 stringr 패키지 string 2021. 1. 15.
R 기초; 웹스크레이핑 base 패키지 R 기초; 웹스크레이핑 base 패키지 string 2021. 1. 14.
R 기초; 텍스트 R 기초; 텍스트 x 2021. 1. 13.

반응형