R在哪里存储临时文件

R在哪里存储临时文件

本文介绍了R在哪里存储临时文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Macbook Air(4GB内存,120GB HD和8GB可用空间)上运行一些基本数据操作.我的输入文件约为40 MB,直到该过程结束,我才将任何内容写到磁盘上.但是,在我的过程中,我的Mac表示没有内存可运行.我检查了硬盘驱动器,发现还剩500MB.所以这是我的问题:

I am running some basic data manipulation on a Macbook Air (4GB Memory, 120GB HD with 8GB available). My input file is about 40 MB, and I don't write anything to the disk until end of the process. However, in the middle of my process, my Mac says there's no memory to run. I checked hard drive and found there's about 500MB left.So here are my questions:

  1. R怎么可能会这么快地填满我的磁盘?我的理解是R将所有内容存储在内存中(除非我明确地将某些内容写到磁盘上).
  2. 如果R确实在磁盘上写入了临时文件,我如何找到这些文件以将其删除?

非常感谢.

更新1:我收到的错误消息:

Update 1: error message I got:

Force Quit Applications: Your Mac OS X startup disk has no more space available for
application memory

更新2:我检查了tempdir()并显示"var/folders/k_xxxxxxx/T//Rtmpdp9GCo".但是我无法在Finder中找到这位导演

Update 2: I checked tempdir() and it shows "var/folders/k_xxxxxxx/T//Rtmpdp9GCo". But I can't locate this director from my Finder

更新3:在R中取消链接(tempdir(),recursive = TRUE)并重新启动计算机后,我收回了磁盘空间.我仍然想知道R是否写在硬盘上,以免将来发生类似情况.

Update 3: After unlink(tempdir(),recursive=TRUE) in R and restarting my computer, I got my disk space back. I still would like to know if R write on my hard drive to avoid similar situations in the future.

更新4:我的主要对象约为1GB.我使用活动监视器来跟踪进程,并且在内存使用量约为2GB时,磁盘活动非常高:数据读取:14GB,数据写入,44GB.我不知道R在写什么.

Update 4: My main object is about 1GB. I use Activity Monitor to track process, and while Memory usage is about 2GB, Disk activity is extremely high: Data read: 14GB, data write, 44GB. I have no idea what R is writing.

推荐答案

R会写入每个会话的临时目录,并在退出时对其进行清理.

R writes to a temporary per-session directory which it also cleans up at exit.

它遵循约定并尊重TMP和相关的环境变量.

It follows convention and respects TMP and related environment variables.

这篇关于R在哪里存储临时文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 21:57