공부/R Programming

R 기초; 입력

혼밥맨 2021. 1. 15. 10:43
반응형

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= "product=fwf.txt", widths=c(4, -1, 10, 8))

read.fwf(file= "product-fwf.txt", widths=c(4, -1, 10, 8), col.names=c("id", "name", "price"))

 

readLines(con="won-dollar.txt")

readLines(con="won-dollar.txt", n=2)

 

scan(file="won-dollar.txt", what=character=())

scan(file="won-dollar.txt", what=list(date=character(), buy=numeric(), sell=numeric()))

 

library(openxlsx)

read.xlsx(xlsxFile="product.xlsx", sheet=1)

 

반응형