数据的管理与清理
• 如何读入数据(注意参数的使用)
• 读csv文件:read.csv
• 读txt文件: read.tale
• 不规则数据:readLines,一行一行的读入
• 读excel文件:read.xlsx, xlsx包
• 读SPSS文件:read.spss,foreign包
• 读SAS文件:read.ssd
read.csv与read.table区别
read.table(file, header = FALSE, sep = "", quote = ""'", dec = ".",
numerals = c("allow.loss", "warn.loss", "no.loss"), row.names,
col.names, as.is = !stringsAsFactors, na.strings = "NA",
colClasses = NA, nrows = -1, skip = 0, check.names = TRUE,
fill = !blank.lines.skip, strip.white = FALSE,
blank.lines.skip = TRUE, comment.char = "#",
allowEscapes = FALSE, flush = FALSE,
stringsAsFactors = default.stringsAsFactors(), fileEncoding = "",
encoding = "unknown", text, skipNul = FALSE)
read.csv(file, header = TRUE, sep = ",", quote = """,
dec = ".", fill = TRUE, comment.char = "", ...)