write.table.ffdf(ff)
write.table.ffdf()所属R语言包:ff
Exporting csv files from ff data.frames
导出csv文件从FF data.frames
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Function write.table.ffdf writes a ffdf object to a separated flat file, very much like (and using) write.table. It can also work with any convenience wrappers like write.csv and provides its own convenience wrapper (e.g. write.csv.ffdf) for R's usual wrappers.
功能write.table.ffdf写了ffdf对象一个分离平面文件,非常喜欢(和使用)write.table的。它也可以与任何方便的包装,如write.csv,并提供了自己的方便包装(如:write.csv.ffdf)R的一贯包装。
用法----------Usage----------
write.table.ffdf(x = NULL
, file, append = FALSE
, nrows = -1, first.rows = NULL, next.rows = NULL
, FUN = "write.table", ...
, transFUN = NULL
, BATCHBYTES = getOption("ffbatchbytes")
, VERBOSE = FALSE
)
write.csv.ffdf(...)
write.csv2.ffdf(...)
write.csv(...)
write.csv2(...)
参数----------Arguments----------
参数:x
a ffdf object which to export to the separated file
一个ffdf对象,出口到单独的文件中
参数:file
either a character string naming a file or a connection open for writing. "" indicates output to the console.
无论是一个字符串,命名为写入打开一个文件或一个连接。 ""表示输出到控制台。
参数:append
logical. Only relevant if file is a character string. If TRUE, the output is appended to the file. If FALSE, any existing file of the name is destroyed.
逻辑。只有相关的,如果file是一个字符串。如果TRUE,输出追加到该文件。如果FALSE,被破坏任何现有文件的名称。
参数:nrows
integer: the maximum number of rows to write in (includes first.rows in case a 'first' chunk is read) Negative and other invalid values are ignored.
整行的最大数目写在(包括first.rows的情况下,第一块被读取)负和其他无效的值将被忽略。
参数:first.rows
the number of rows to write with the first chunk (default: next.rows)
的行数写的第一个块(默认:next.rows)
参数:next.rows
integer: number of rows to write in further chunks, see details. By default calculated as BATCHBYTES %/% sum(.rambytes[vmode(x)])
整数的行数写在进一步块,查看详情。默认情况下,计算公式为BATCHBYTES %/% sum(.rambytes[vmode(x)])
参数:FUN
character: name of a function that is called for writing each chunk, see write.table, write.csv, etc.
特点:写每块调用的函数的名称,请参阅write.table,write.csv,等
参数:...
further arguments, passed to FUN in write.table.ffdf, or passed to write.table.ffdf in the convenience wrappers
进一步的论据,传递给FUNwrite.table.ffdf,或通过write.table.ffdf在方便的包装
参数:transFUN
NULL or a function that is called on each data.frame chunk before writing with FUN (for filtering, transformations etc.)
NULL或过滤,转换等FUN(之前写一个函数被调用每一个数据框块)
参数:BATCHBYTES
integer: bytes allowed for the size of the data.frame storing the result of reading one chunk. Default getOption("ffbatchbytes").
整数:字节允许data.frame存储的结果读取一个组块的大小。默认getOption("ffbatchbytes")。
参数:VERBOSE
logical: TRUE to verbose timings for each processed chunk (default FALSE)
逻辑:TRUE详细计时每一个处理块(默认为FALSE)
Details
详细信息----------Details----------
write.table.ffdf has been designed to export very large ffdf objects to separated flatfiles in chunks. The first chunk is potentially written with col.names. Further chunks are appended. <br> write.table.ffdf has been designed to behave as much like write.table as possible. However, note the following differences:
write.table.ffdf已被设计为非常大的ffdf对象导出块分离flatfiles。是可能写的col.names的的第一个块。进一步块被追加。参考write.table.ffdf已被设计为表现为很像write.table尽可能。但是,请注意以下区别:
by default row.names are only written if the ffdf has row.names.
默认情况下,row.names是只写,如果ffdf有row.names。
值----------Value----------
invisible
invisible
注意----------Note----------
write.csv and write.csv2 have been fixed in order to suppress col.names if append=TRUE is passed. Note also that write.table.ffdf passes col.names=FALSE for all chunks following the first chunk - but not so for FUN="write.csv" and FUN="write.csv2" .
write.csv和write.csv2已得到修复,以抑制col.names如果append=TRUE传递。另请注意,这write.table.ffdf通行证col.names=FALSE所有的第一个块的块 - 但不是那么FUN="write.csv"和FUN="write.csv2"。
(作者)----------Author(s)----------
Jens Oehlschl盲gel, Christophe Dutang
参见----------See Also----------
read.table.ffdf, write.table, ffdf
read.table.ffdf,write.table,ffdf
实例----------Examples----------
x <- data.frame(log=rep(c(FALSE, TRUE), length.out=26), int=1:26, dbl=1:26 + 0.1, fac=factor(letters), ord=ordered(LETTERS), dct=Sys.time()+1:26, dat=seq(as.Date("1910/1/1"), length.out=26, by=1))
ffx <- as.ffdf(x)
csvfile <- tempPathFile(path=getOption("fftempdir"), extension="csv")
write.csv.ffdf(ffx, file=csvfile)
write.csv.ffdf(ffx, file=csvfile, append=TRUE)
ffy <- read.csv.ffdf(file=csvfile, header=TRUE, colClasses=c(ord="ordered", dct="POSIXct", dat="Date"))
rm(ffx, ffy); gc()
unlink(csvfile)
## Not run: [#不运行:]
# Attention, this takes very long[注意,这需要很长的]
vmodes <- c(log="boolean", int="byte", dbl="single", fac="short", ord="short", dct="single", dat="single")
message("create a ffdf with 7 columns and 78 mio rows")
system.time({
x <- data.frame(log=rep(c(FALSE, TRUE), length.out=26), int=1:26, dbl=1:26 + 0.1, fac=factor(letters), ord=ordered(LETTERS), dct=Sys.time()+1:26, dat=seq(as.Date("1910/1/1"), length.out=26, by=1))
x <- do.call("rbind", rep(list(x), 10))
x <- do.call("rbind", rep(list(x), 10))
x <- do.call("rbind", rep(list(x), 10))
x <- do.call("rbind", rep(list(x), 10))
ffx <- as.ffdf(x, vmode = vmodes)
for (i in 2:300){
message(i, "\n")
last <- nrow(ffx) + nrow(x)
first <- last - nrow(x) + 1L
nrow(ffx) <- last
ffx[first:last,] <- x
}
})
csvfile <- tempPathFile(path=getOption("fftempdir"), extension="csv")
write.csv.ffdf(ffx, file=csvfile, VERBOSE=TRUE)
ffy <- read.csv.ffdf(file=csvfile, header=TRUE, colClasses=c(ord="ordered", dct="POSIXct", dat="Date"), asffdf_args=list(vmode = vmodes), VERBOSE=TRUE)
rm(ffx, ffy); gc()
unlink(csvfile)
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|