Skip to contents

In cases you want to write to a file which you do not want to override if existing. This helper function checks if a file exists, if it does it just appends an integer to the filename Source originally by user spacedman on stackoverflow.

Usage

serialNext(path, n_digits = 3, maxruns = 500, ...)

Arguments

path

Character containing the path with fileextensions

n_digits

(Optional) Integer, number of leadings 0 before the filename. Default is n_digits = 3

maxruns

(Optional) Integer, Default is maxruns = 500.

...

(Optional) Additional Parameters, not utiliezd in this function, enables passing from passing of previous functions

Value

Character, a filename that currently does not exists, with indices.

Author

spacedman stackoverflow (advanced by Bjoern Buedenbender)