简体   繁体   English

在 R 中将 data.frame 转换为分隔字符串的函数的高性能实现

[英]Performant implementation of function for converting data.frame to delimited string in R

I am looking for a fast serialization function to convert a data.frame to a delimited string in R .我正在寻找一个快速序列化函数来将 data.frame 转换为 R 中的分隔字符串 At the moment I am using readr::format_tsv (Versions readr_2.0.0 vroom_1.5.3 ) for the conversion and I am wondering if there is a faster implementation available.目前我正在使用readr::format_tsv (版本readr_2.0.0 vroom_1.5.3 )进行转换,我想知道是否有更快的实现可用。 For the example below the conversion takes around 4.4 seconds which is too slow for my purpose.对于下面的示例,转换大约需要 4.4 秒,这对我来说太慢了。

system.time()系统时间()

   user  system elapsed 
  3.878   0.495   4.372 

Example例子

df= data.frame(replicate(400, runif(35000, min=0, max=100)))

system.time({
  tsv = readr::format_tsv(df)
})

性能问题得到解决: https : //github.com/r-lib/vroom/issues/377

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM