Counter with file storage
filename = "count.txt"
count <- 0
if (file.exists(filename)) {
count <- as.numeric(readLines(filename))
}
count <- count + 1
cat(count, end="\n")
fh <- file(filename, "w")
cat(count, end="\n", file = fh)
close(fh)
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
filename = "count.txt"
count <- 0
if (file.exists(filename)) {
count <- as.numeric(readLines(filename))
}
count <- count + 1
cat(count, end="\n")
fh <- file(filename, "w")
cat(count, end="\n", file = fh)
close(fh)