📅  最后修改于: 2022-03-11 14:52:01.037000             🧑  作者: Mango
#utils Package
##Output as Data Frame
###Mother Import Function of two functions below
read.table("data.txt", sep = "", col.names = c("x", "y"),
colClasses = c("factor", "NULL"))
read.csv("data.csv", stringAsFactor = F, header = F) #Header and SAF Default True
read.delim("data.txt", stringAsFactor = F, header = F) #Header and SAF Default True
##col.names and colClasses argument could be also passed in read.csv() and read.delim() function
#readr Package
##Output as tbl_df, tbl & data.frame
###Mother Import Function of two functions below
read_delim("data.txt", col_names = c("x", "y"), col_names
delim = "" #delim in readr is same as sep in utils
col_types = "cd") # c = character, d = double, i = integer, l = logical, _ = skip
read_csv("data.csv") #SAF Default FALSE, header Default True
read_tsv("data.txt")
#fread function (data.table Package)
##Output as data.table & data.frame
fread("data.csv", #Default auto determine header, coltypes and sep
drop = 2:4,
select = c("a", "e"))