library(remoji)
library(wakatimer)

Setup (recommend)

  1. Create WakaTime accont.
  2. Configure your own API key.
  3. Registry application and to get an OAuth 2.0 client token to use wakatimer.
# wakatime api key and app id set to R global environment 
Sys.setenv("WAKATIME_KEY" = "<your api key>")
Sys.setenv("WAKATIME_ID" = "<application id>")
Sys.setenv("WAKATIME_SECRET" = "<application secret>")

# also add to .RProfile
key = Sys.getenv("WAKATIME_KEY")
app.id     = Sys.getenv("WAKATIME_ID")
app.secret = Sys.getenv("WAKATIME_SECRET")
# Continue to authorize
write_scope()

The wakatimer begin to record your code as heartbeats! r emoji("computer")R (3.2.3) r emoji("large_blue_circle")RStudio (0.99.868) r emoji("package")wakatimer (0.1.1)

That's all! Use like you normally do and your time will record by log.

# Normally terminate r session
#   Data POST to WakaTime as heartbeats
#   wait for a moment...  
q()

The {wakatimer} provide current sessions modificate file information will sent to WakaTime!! Visit https://wakatime.com to see your logged time. However, when in such situation out of scope for post to wakatime API 1) Force Quit RStudio 2) Restart R.

When unconnect to internet, heartbeats save to local database.

API Request

wakatimer:::wt_api(resource = "heartbeats", 
                   key = Sys.getenv("WAKATIME_KEY"), 
                   param = list(date = format(Sys.Date(), "%m/%d/%Y"), time = "time", "entity"))

Send Heartbeat

{wakatimer} is automatically log and post information that files in project directory when internet connection. Here, I indicate that to sent indivual heartbeat method.

devtools::session_info()


uribo/wakatimer documentation built on May 3, 2019, 2:37 p.m.