在R中创建“libloc_%2f ... Builts.rds”临时文件的原因是什么?

时间:2011-09-19 18:53:23

标签: r temporary-files

我正在R中运行一个经常重启的服务器进程,它使用许多R包。现在,每次重启都会创建一个临时目录,其中包含一些带有“rds”扩展名的文件。我真的想知道哪个R包或功能导致创建这些.rds文件(所以我可以禁用它)。谢谢!

文件名如下所示:

libloc_%2fusr%2flib%2FR%2flibraryVersion,优先级,取决于进口,LinkingTo,顾名思义,提高,操作系统类型,许可,Archs,Built.rds

并且内容的开头如下所示:

      [,1]         [,2]                 [,3]          [,4]          [,5]                                              
 [1,] "KernSmooth" "/usr/lib/R/library" "2.23-6"      "recommended" "R (>= 2.5.0), stats"                             
 [2,] "MASS"       "/usr/lib/R/library" "7.3-13"      "recommended" "R (>= 2.13.0), grDevices, graphics, stats, utils"
 [3,] "Matrix"     "/usr/lib/R/library" "0.999375-50" "recommended" "R (>= 2.10.0), stats, methods, utils, lattice"   
 [4,] "base"       "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
 [5,] "class"      "/usr/lib/R/library" "7.3-2"       "recommended" "R (>= 2.5.0), stats, utils"                      
 [6,] "compiler"   "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
 [7,] "datasets"   "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
 [8,] "grDevices"  "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
 [9,] "graphics"   "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[10,] "grid"       "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[11,] "lattice"    "/usr/lib/R/library" "0.19-26"     "recommended" "R (>= 2.11.0)"                                   
[12,] "methods"    "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[13,] "nnet"       "/usr/lib/R/library" "7.3-1"       "recommended" "R (>= 2.5.0), stats, utils"                      
[14,] "spatial"    "/usr/lib/R/library" "7.3-2"       "recommended" "R (>= 2.5.0), graphics, stats, utils"            
[15,] "splines"    "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[16,] "stats"      "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[17,] "stats4"     "/usr/lib/R/library" "2.13.0"      "base"        "methods, graphics, stats"                        
[18,] "tcltk"      "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[19,] "tools"      "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[20,] "utils"      "/usr/lib/R/library" "2.13.0"      "base"        NA                                                

1 个答案:

答案 0 :(得分:2)

它看起来像installed.packages()创建的文件。检查此功能的来源。

也许您已在启动资料中调用它(例如会话开始时为update.packages())?

您可以启用saveRDS功能的跟踪,例如添加到.Rprofile:

trace("saveRDS", function() print(str(head(sys.calls(),-5))))

这将打印(您也可以将其转储到文件中)调用堆栈,例如当我运行update.packages(ask='graphics')然后在控制台上我得到了:

Tracing saveRDS(res0, dest, compress = TRUE) on entry 
List of 3
 $ : language update.packages(ask = "graphics")
 $ : language available.packages(contriburl = contriburl, method = method)
 $ : language saveRDS(res0, dest, compress = TRUE)
NULL
Tracing saveRDS(res0, dest, compress = TRUE) on entry 
List of 3
 $ : language update.packages(ask = "graphics")
 $ : language available.packages(contriburl = contriburl, method = method)
 $ : language saveRDS(res0, dest, compress = TRUE)
# ..... and few more calls ...............