8000 GitHub - mkmiecik14/r4eyes: .RProfile file that saves your eyes from excessive strain due to programming!
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

mkmiecik14/r4eyes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

r4eyes

.RProfile file that saves your eyes from excessive strain due to programming!

My optometrist recommended that every 20 minutes I look away from the computer screen to take a break for 20 seconds and look at something at least 20 feet away. I found this advice difficult to implement, as 20 minutes would go by and I would often forget.

With this .Rprofile file, the reminders are automatic and print every 20 minutes to your console.

r4eyes/.Rprofile

Lines 1 to 24 in 16cf062

# .RProfile file that prints a message to the console every 20 minutes
# reminding you to take a break for 20 seconds and look at something at least
# 20 feet or farther in the distance
# checks to see if later is installed
if (system.file(package = "later") == "") {
print("You do not have the package `later` installed")
print("Please install `later` for this .Rprofile to work.")
print("install.packages('later')")
}
# rest_eyes function
rest_eyes <- function(m = 20) {
seconds <- m*60 # later() expects seconds, so this converts arg to seconds
print(
paste(
"It's been",
m,
"minutes. Take a 20 second break and look at something at least 20 feet away!"
)
)
later::later(~rest_eyes, seconds) # delays next print to m minutes
}
later::later(~rest_eyes, 20*60) # this delays the first print to 20 min

Happy programming in R!

Acknowledgements

Thank you to the later package and this blog post from Yihui Xie.

About

.RProfile file that saves your eyes from excessive strain due to programming!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0