当前位置:   article > 正文

[转载] R语言read.table函数_r read.table skipnul

r read.table skipnul

参考链接: C++ Vector.data()函数

           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) 

 

 

file 文件名,在windows系统下可为“dir\\example.txt”,在linux系统下为“dir/example.txt”

 

 

 headerheader设置为TRUE,表示第一行的内容是每一列的名字sep分隔符,默认sep = ""(空格)quotequote只对被当做character的列有效decthe character used in the file for decimal points.numeralsstring indicating how to convert numbers whose conversion to double precision would lose accuracyrow.names行名的向量col.names列名的向量as.isthe default behavior of read.table is to convert character variables (which are not converted to logical, numeric or complex) to factors. The variable as.is controls the conversion of columns not otherwise specified by colClasses. Its value is either a vector of logicals (values are recycled if necessary), or a vector of numeric or character indices which specify which columns should not be converted to factors.Note: to suppress all conversions including those of numeric columns, set colClasses = "character".Note that as.is is specified per column (not per variable) and so includes the column of row names (if any) and any columns to be skipped.na.stringsa character vector of strings which are to be interpreted as NA values. Blank fields are also considered to be missing values in logical, integer, numeric and complex fields. Note that the test happens after white space is stripped from the input, so na.strings values may need their own white space stripped in advance.colClasses表示读出的列的类型("character"、"numeric"、"Date"等)nrows正整数,表示读入的最大行数skipinteger: the number of lines of the data file to skip before beginning to read data.check.nameslogical. If TRUE then the names of the variables in the data frame are checked to ensure that they are syntactically valid variable names. If necessary they are adjusted (by make.names) so that they are, and also to ensure that there are no duplicates.filllogical. If TRUE then in case the rows have unequal length, blank fields are implicitly added. See ‘Details’.strip.whitelogical. Used only when sep has been specified, and allows the stripping of leading and trailing white space from unquoted character fields (numeric fields are always stripped). See scan for further details (including the exact meaning of ‘white space’), remembering that the columns may include the row names.blank.lines.skiplogical: if TRUE blank lines in the input are ignored.comment.charcharacter: a character vector of length one containing a single character or an empty string. Use "" to turn off the interpretation of comments altogether.allowEscapeslogical. Should C-style escapes such as \n be processed or read verbatim (the default)? Note that if not within quotes these could be interpreted as a delimiter (but not as a comment character). For more details see scan.flushlogical: if TRUE, scan will flush to the end of the line after reading the last of the fields requested. This allows putting comments after the last field.stringsAsFactorslogical: should character vectors be converted to factors? Note that this is overridden by as.is and colClasses, both of which allow finer control.fileEncodingcharacter string: if non-empty declares the encoding used on a file (not a connection) so the character data can be re-encoded. See the ‘Encoding’ section of the help for file, the ‘R Data Import/Export Manual’ and ‘Note’.encodingencoding to be assumed for input strings. It is used to mark character strings as known to be in Latin-1 or UTF-8 (see Encoding): it is not used to re-encode the input, but allows R to handle encoded strings in their native encoding (if one of those two). See ‘Value’ and ‘Note’.textcharacter string: if file is not supplied and this is, then data are read from the value of text via a text connection. Notice that a literal string can be used to include (small) data sets within R code.skipNullogical: should nuls be skipped?

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/202209
推荐阅读
相关标签
  

闽ICP备14008679号