FileExists | R Documentation |
The function FileExists
checks whether a file or a lock-file
exists
The function LockRemove
removes a lock-file
FileExists(file, printlevel=RFoptions()$basic$printlevel) LockFile(file, printlevel=RFoptions()$basic$printlevel) LockRemove(file) WaitOthers(file, i, cores, ideal.processes=ceiling(cores * 1.25), max.processes=ceiling(cores * 1.5), distance=5, time=5, path="./")
file |
name of the data file |
printlevel |
if |
i |
integer; current value of process, usually the number of a loop index |
cores |
the number of cores on the machine |
ideal.processes,max.processes,distance |
integer. See Details |
time |
in minutes a process waits until it rechecks its environment |
path |
the current path of |
FileExists
checks whether file or file.lock exists.
If none of them exists file
.lock is created and hostname and
PID are written into file
.lock. This is useful if several processes
use the same directory. Further, it is checked whether another process
has tried to create the same file in the same instance. In this case
FileExists
returns for at least one of the processes that
file
.lock has already been created.
LockFile
is the same as FileExists
except that it does
not check whether file
already exists.
WaitOthers
waits for others if more than ideal.processes
processes have
their value is less than i
or if more than cores
processes have
their value is less than i
-distance
.
It also waits if there are alreay max.processes
are active.
Note that WaitOthers
write a file with ending
‘.wait’, which is also deleted be LockRemove
.
FileExists
returns
1 |
if |
2 |
if |
3 |
if |
0 |
otherwise, |
## Not run: ## the next command checks whether the file 'data.rda' ## or the file 'data.rda.lock' exists. If so, a positive ## value is returned. If not, the file 'data.rda.lock' ## is created and the value 0 returned. FileExists("data.rda") ## the next command deletes the file 'data.rda.lock' LockRemove("data.rda") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.